Ruby on Rails Friday, April 29, 2011

hi,
i would like to change a partial in my view with the change of the
item in a select_tag:

in the view:

<%= observe_field("payment_id", :url => {:controller
=>'user_admins' ,:action => 'rend_part'},:on => 'change', :frequency
=> 0.1) %>
<%= select( "payment", "id", { "Visa" => "1", "Mastercard" => "2"}) %>

in controller :

def rend_part

if params[:payment]['id'] == '1'
render :partial => "patial_one"
else
render :partial => "patial_two"

end
end

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment