Quick start
Requirements
- If you want to get full advantage for this gem you need to have installed RSpec and FactoryBot in your application.
- RSpec: https://github.com/rspec/rspec-rails
- Factory bot: https://github.com/thoughtbot/factory_bot_rails
Installation
ruby
# Build a Ruby on Rails REST API faster
gem "rest-api-generator"
And then execute:
bundle install
- Include in
ApplicationController
the error handler module:
ruby
class ApplicationController < ActionController::API
include RestApiGenerator::ErrorHandler
end
- Create a resource using following command:
rails g rest_api_generator:resource <resource_name> <attributes>
Example:
rails g rest_api_generator:resource car name:string color:string