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
rm app/views/posts/*
rails generate resource Post name:string title:string content:text
rails 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.