Sunday, May 26, 2013

[Rails] proper way to generate REST API?

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@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
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.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate