When I use rails g scaffold Model key:string value:string command it creates both controller and views (erb, scss, js). How can I generate only controller which will respond with only JSON format.
When I use rails g scaffold Model key:string value:string command it creates both controller and views (erb, scss, js). How can I generate only controller which will respond with only JSON format.
Without having to modify configuration:
rails g scaffold TestLink --api
Pro tip: Use the --pretend flag to see what will be created before running:
rails g scaffold TestLink --api --pretend
If you already have a project setup as a normal rails app, you can make the generators api only by setting it up in config/application.rb.
config.generators do |g|
g.api_only = true
end