lunaclaire
2009-Aug-19 23:21 UTC
RESTful routing, in-place editing, and creating new resource obj - design question
I''m working on adding in-place editing of one of my RESTful resources and I need advice on how to make a change to the design patterns we all know and love for the creation/editing of a new resource object. Out of the box, Rails gives you the ''new'' and ''create'' actions for creating a new resource object. This is fine for when you want a separate page for initial creation and subsequent editing of that resource. But, now with in-place editing, my edits take place via the ''show'' view with AJAX handling of those in place edts. So, what''s the approach for when the user goes to create a new resource obj? I thought I could just redirect from the ''new'' action to the ''show'' action after creating the new obj, but with RESTful routing this takes me to the index view. Anybody know how to do this? Or is it best practice to still have a full page edit form for the initial edit and only go to in-place editing for subsequent edits? --- A second issue involves validations... If I am able to do the in place edit at creation, I have to create a new object for the ''show'' action, but there isnt any data actually entered prior to going there, so I cant save the object because it wouldnt validate... so is there a way to pass the unsaved object to the show action in this case?
Aldric Giacomoni
2009-Aug-20 17:01 UTC
Re: RESTful routing, in-place editing, and creating new resource obj - design question
I believe that in this tutorial lie the answers to some if not all of your questions: http://www.buildingwebapps.com/learningrails I followed it a little while back and it clicked a lot of things about Rails for me, and it does talk about in-place editing among others. Check it out, it may just be what you''re looking for :) -- Posted via http://www.ruby-forum.com/.
lunaclaire
2009-Aug-21 06:04 UTC
Re: RESTful routing, in-place editing, and creating new resource obj - design question
Thx, Aldric.... but, could you pt me to the specific page for the tutorial you mentioned? On Aug 20, 10:01 am, Aldric Giacomoni <rails-mailing-l...@andreas- s.net> wrote:> I believe that in this tutorial lie the answers to some if not all of > your questions:http://www.buildingwebapps.com/learningrails > > I followed it a little while back and it clicked a lot of things about > Rails for me, and it does talk about in-place editing among others. > Check it out, it may just be what you''re looking for :) > -- > Posted viahttp://www.ruby-forum.com/.
Aldric Giacomoni
2009-Aug-21 15:31 UTC
Re: RESTful routing, in-place editing, and creating new resource obj - design question
lunaclaire wrote:> Thx, Aldric.... but, could you pt me to the specific page for the > tutorial you mentioned? > > > On Aug 20, 10:01�am, Aldric Giacomoni <rails-mailing-l...@andreas-If you''re familiar enough with rails to read and understand, you''ll want to at least read lessons 10 and on to understand how they''re building their app (it''s pretty quick): http://www.buildingwebapps.com/podcasts/6663-putting-the-page-contents-into-the/show_notes Until you get to lesson 14: http://www.buildingwebapps.com/podcasts/6746-using-textile-markup-plus-in-place-editing/show_notes -- Posted via http://www.ruby-forum.com/.
lunaclaire
2009-Aug-24 21:29 UTC
Re: RESTful routing, in-place editing, and creating new resource obj - design question
for anyone else looking into this... I guess I didnt find my answers on best practices for this, but I solved the RESTful routing to my index page by creating a named route for creating the new resource and going right to its ''show'' action/ view. Also, to solve the initial validation prob, I just stuff it with valid, dummy data and then let the user edit it. On Aug 21, 8:31 am, Aldric Giacomoni <rails-mailing-l...@andreas- s.net> wrote:> lunaclaire wrote: > > Thx, Aldric.... but, could you pt me to the specific page for the > > tutorial you mentioned? > > > On Aug 20, 10:01 am, Aldric Giacomoni <rails-mailing-l...@andreas- > > If you''re familiar enough with rails to read and understand, you''ll want > to at least read lessons 10 and on to understand how they''re building > their app (it''s pretty quick): > > http://www.buildingwebapps.com/podcasts/6663-putting-the-page-content... > > Until you get to lesson 14: > > http://www.buildingwebapps.com/podcasts/6746-using-textile-markup-plu... > -- > Posted viahttp://www.ruby-forum.com/.
lunaclaire
2009-Aug-24 21:30 UTC
Re: RESTful routing, in-place editing, and creating new resource obj - design question
for anyone else looking into this... I guess I didnt find my answers on best practices for this, but I solved the RESTful routing to my index page by creating a named route for creating the new resource and going right to its ''show'' action/ view. Also, to solve the initial validation prob, I just stuff it with valid, dummy data and then let the user edit it. On Aug 21, 8:31 am, Aldric Giacomoni <rails-mailing-l...@andreas- s.net> wrote:> lunaclaire wrote: > > Thx, Aldric.... but, could you pt me to the specific page for the > > tutorial you mentioned? > > > On Aug 20, 10:01 am, Aldric Giacomoni <rails-mailing-l...@andreas- > > If you''re familiar enough with rails to read and understand, you''ll want > to at least read lessons 10 and on to understand how they''re building > their app (it''s pretty quick): > > http://www.buildingwebapps.com/podcasts/6663-putting-the-page-content... > > Until you get to lesson 14: > > http://www.buildingwebapps.com/podcasts/6746-using-textile-markup-plu... > -- > Posted viahttp://www.ruby-forum.com/.