Hi everybody, a few days ago I began to build a group manager which only use AJAX for the CRUD - functions. But I have some problems now. The content of the database table will be editable by cklicking on the name of the group (see on the attached image). After that the name will be replaced by an input tag and some buttons will be displayed with different functions. My problem is that Rails need the ID of this table row for the form to submit the data to my update - method. Is there a way to update the data without a form? Eddy Attachments: http://www.ruby-forum.com/attachment/2112/index.png -- 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 not 100% sure what exactly you want to do :-) But of course you can send technically whatever you want to rails as a param in a call with link_to, link_to_remote, remote_function or whatever function that establishes a connection browser/server In most cases you will only send an id and the necessary data to update it. link_to "update something", something_path(foo.id, :something_more => "new text") is the most primitive way If you want to "simulate" form behavior, to reuse the update controller you use anyway, the only important thing is the naming of the params. If you look at the generated html for a form, you''ll notice that field naming follows the convention name="model[method]" so if you have a User form and a name field link_to "update user", user_path(user.id, "user[name]" => "new name") could be sent and would be accessible as params[:user][:name] as usual -- 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 -~----------~----~----~----~------~----~------~--~---
Thorsten Mueller wrote:> I''m not 100% sure what exactly you want to do :-) > > But of course you can send technically whatever you want to rails as a > param in a call with link_to, link_to_remote, remote_function or > whatever function that establishes a connection browser/server > > In most cases you will only send an id and the necessary data to update > it. > > link_to "update something", something_path(foo.id, :something_more => > "new text") > is the most primitive way > > If you want to "simulate" form behavior, to reuse the update controller > you use anyway, the only important thing is the naming of the params. > If you look at the generated html for a form, you''ll notice that field > naming follows the convention name="model[method]" > > so if you have a User form and a name field > link_to "update user", user_path(user.id, "user[name]" => "new name") > could be sent and would be accessible as > params[:user][:name] as usualI solve the problem with a little javascript which manipulate the action attribute of my form and it update my data like a champ ;-) Thanks Thorsten for your help! -- 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 -~----------~----~----~----~------~----~------~--~---