Hello I''d like to make a list of items and then when an item is clicked, I display the "edit" view, something like @items = Item.find(:all) <%= select ''my_items'', select_options(@items), :onchange => remote_function(edit_item_path(item)) %> How can I pass only the clicked Item to the edit view : edit_item_path(item) thanks -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''m using the following:
:onChange => remote_function(:url => {:action =>
''choose_stylist''}, :with =>
"''stylist='' + value")
You might be able to do this:
:onChange => remote_function(edit_item_path, :with =>
"''item='' +
value")
You might need to set up ''edit_item'' in your controller to use
params[:item] in this case - I''m not sure. I think that the
'':with =>
stuff'' is what you need, though.
-Kyle
On Mar 26, 5:43 am, "Abir B."
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> Hello
> I''d like to make a list of items and then when an item is clicked,
I
> display the "edit" view, something like
> @items = Item.find(:all)
> <%= select ''my_items'', select_options(@items),
:onchange =>
> remote_function(edit_item_path(item)) %>
> How can I pass only the clicked Item to the edit view :
> edit_item_path(item)
>
> thanks
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Kyle wrote:> I''m using the following: > > :onChange => remote_function(:url => {:action => > ''choose_stylist''}, :with => "''stylist='' + value") > > You might be able to do this: > > :onChange => remote_function(edit_item_path, :with => "''item='' + > value") > > You might need to set up ''edit_item'' in your controller to use > params[:item] in this case - I''m not sure. I think that the '':with => > stuff'' is what you need, though. > > -Kyle > > On Mar 26, 5:43 am, "Abir B." <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>The problem is that edit_item_path require an id, and must be written edit_item_path(id) so can someone tell me how change the route edit_item_path so that It does''nt require this param?? thanks -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I wonder if it might be as simple as this: :onChange => remote_function(edit_item_path(value)) ? -Kyle On Mar 27, 3:52 am, "Abir B." <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Kyle wrote: > > I''m using the following: > > > :onChange => remote_function(:url => {:action => > > ''choose_stylist''}, :with => "''stylist='' + value") > > > You might be able to do this: > > > :onChange => remote_function(edit_item_path, :with => "''item='' + > > value") > > > You might need to set up ''edit_item'' in your controller to use > > params[:item] in this case - I''m not sure. I think that the '':with => > > stuff'' is what you need, though. > > > -Kyle > > > On Mar 26, 5:43 am, "Abir B." <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > The problem is that edit_item_path require an id, and must be written > edit_item_path(id) so can someone tell me how change the route > edit_item_path so that It does''nt require this param?? > thanks > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---