I''ve recently made the upgrade to rails 2 and it seems to really encourage restful design now. So I''ve been looking into that and I am getting the hang of it, but it really bothers me to have to manually setup the REST actions in the controller. It seems like there should be some way to script/generate restful controller or something for example: script/generate controller posts would be smart enough to go ahead and include actions (index, show, new, create, edit, update and delete) and also go ahead and fill them out smartly based on the controller name, and knowing that I want a restful controller and that I have a model with the same name. so it would already have: def index @posts = Post.find(:all) end def new @post = Post.new end etc. Is there a way to do this? If not, is this the sort of thing people would usually write a plugin for? Maybe I could look into writing a plugin for it. -- 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 -~----------~----~----~----~------~----~------~--~---
On 21 Jun 2008, at 17:51, Chris G. wrote:> > I''ve recently made the upgrade to rails 2 and it seems to really > encourage restful design now. > So I''ve been looking into that and I am getting the hang of it, but it > really bothers me to have to manually setup the REST actions in the > controller. > > It seems like there should be some way to script/generate restful > controller or something for example: > script/generate controller postsThe scaffold generator in rails 2 and above generates a restful scaffold. Fred> > > would be smart enough to go ahead and include actions (index, show, > new, > create, edit, update and delete) and also go ahead and fill them out > smartly based on the controller name, and knowing that I want a > restful > controller and that I have a model with the same name. > > so it would already have: > > def index > @posts = Post.find(:all) > end > > def new > @post = Post.new > end > > etc. > > Is there a way to do this? > > If not, is this the sort of thing people would usually write a plugin > for? Maybe I could look into writing a plugin for it. > -- > 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 -~----------~----~----~----~------~----~------~--~---
Thanks, I wondered about that, I haven''t generated scaffold since I was first using rails a couple of years ago. Thanks for the quick reply. Chris -- 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 -~----------~----~----~----~------~----~------~--~---