# Active model serializers gem 'active_model_serializers', '~> 0.10.2' rails g serializer movie //==> class MovieSerializer < ActiveModel::Serializer attributes :id, :name end //active model serializer //create into cingof/initializer/active_model_serializer.rb and paste: ActiveModelSerializers.config.adapter = :json_api //Rswag //Add gems: # Rswag gem 'rswag' group :development, :test do gem "debug", platforms: %i[ mri mingw x64_mingw ] gem 'rspec-rails' end //install rspec rails generate rspec:install //Generate scaffold controller rails g scaffold_controller api/v1/categories name:string description:text --api --model-name=Category //install rswag rails g rswag:install //generate test rails generate rspec:swagger Api::V1::ProductsController --spec_path integration //Generate document rake rswag:specs:swaggerize
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter