I''m trying to figure out the "correct" commands for scaffolding out a REST API, i.e. something that will accept JSON, but not present a view. rails generate scaffold Post name:string title:string content:text will generate the models controllers, and views, whereas I don''t need any of the ERB stuff since there is no web view. rails generate resource Post name:string title:string content:text Generates the database stuff, but doesn''t seem to fill out the controller at all. What''s the best way to approach this? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/2440bdc6-e94e-49bf-9de5-c54e7a1f3b96%40googlegroups.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
Brendan Miller wrote in post #1110215:> I''m trying to figure out the "correct" commands for scaffolding out a > REST > API, i.e. something that will accept JSON, but not present a view. > > rails generate scaffold Post name:string title:string content:textrm app/views/posts/*> rails generate resource Post name:string title:string content:textrails generate api_scaffold Post name:string title:string content:text After creating your own api_scaffold rake task, of course. You should be able to base it on the normal rails scaffolding task and remove the parts that generate the views. Just guessing since I''ve not looked at the Rails rake tasks in detail, but if you learn a bit about rake it shouldn''t be that difficult.> What''s the best way to approach this?Simplest is obviously to just remove the generated views, but the "best" might be to create you own rake task. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/f78b935829a8acb05efcd6cee060b130%40ruby-forum.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.