Hi, After generating code of Scaffold. I am able to see the code for List/Edit/Delete/Show operations. Now, I want to modify the code such a way that: I can edit a record, there itself, without taking me to a new page. 1. link_to_remote: is not useful as edit requires form submition. 2. form_remote_tag: is feasible but, List requires a loop to run and text_field doesn''t work in a loop. Also, each record has to be considered as a seperate "div" tag, but List uses a loop, How to generate so many div''s dynamically? Please suggest me, if there is any other alternative to do this. Thanks and Regards, Sandeep. -- 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 -~----------~----~----~----~------~----~------~--~---
1)in the list, change the Link "edit" to a link_to_remote calling the
edit action,
2) add a div to the list.rhtml below the content loop and give it the
id="ajaxform"
3) in the edit action, use respond_to to check if this is an ajax call:
#somewhere in the edit action the post to edit will be received ...
@post = Post.find(params[:id])
respond_to do |request|
request.html
request.rjs {
render :update { |page| page.replace_html
:"ajaxform",:partial => ''form'' }
}
end
this code will surely not work out of the box, i think you still have
to add the submit button, using
page.insert_html :bottom, ''ajaxform'', ''<input
type="submit"
value="Save"''
or something like that... play around with it.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Hi Thorsten, Thats a good idea. It works, I guess. Thank you. Any other ideas, from others. -Sandeep. -- 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 -~----------~----~----~----~------~----~------~--~---