How to return Rails API mode to Rails

Commands when building the Rails API

docker-compose run web rails new . --force --database=mysql --api --skip-bundle

You have now generated the Rails API. ↓ I want to return to normal Rails. ↓ In the same directory, this time pulling --api,

docker-compose run web rails new . --force --database=mysql --skip-bundle

The file created during the Rails API remains as it is.

application_controller.rb


- class ApplicationController < ActionController::API
+ class ApplicationController < ActionController::Base

application.rb


- config.api_only = false

All you have to do now is run the required commands in docker.

docker-compose build
docker-compose run web rails db:create
docker-compose up -d

Supplement https://shakacode.gitbooks.io/react-on-rails/content/docs/additional-reading/convert-rails-5-api-only-app.html https://stackoverflow.com/questions/36669981/how-do-you-convert-a-rails-5-api-app-to-a-rails-app-that-can-act-as-both-api-and

Recommended Posts

How to return Rails API mode to Rails
How to write Rails
How to uninstall Rails
How to build API with GraphQL and Rails
[rails] How to post images
How to use Chain API
[Rails] How to use enum
How to use Ruby return
[Rails] How to install devise
[Rails] How to use enum
How to read rails routes
How to use rails join
How to terminate rails server
How to write Rails validation
How to write Rails seed
[Rails] How to use validation
[Rails] How to disable turbolinks
[Rails] How to use authenticate_user!
[Rails] How to use "kaminari"
[Rails] How to implement scraping
[Rails] How to make seed
How to write Rails routing
[Rails] How to install simple_calendar
[Rails] How to install reCAPTCHA
[Rails] How to use Scope
[Rails] How to use gem "devise"
How to deploy jQuery on Rails
[Rails] How to install Font Awesome
Rails API
[Rails] How to use devise (Note)
[Rails] How to use flash messages
[rails] How to display db information
[Rails] How to write in Japanese
[Rails] How to prevent screen transition
How to use Ruby on Rails
How to deploy Bootstrap on Rails
[Rails] Use cookies in API mode
[Rails] How to speed up docker-compose
How to change kube-proxy to ipvs mode.
[Rails] How to add new pages
Rails on Tiles (how to write)
[Rails] How to install ImageMagick (RMajick)
[Rails] How to install Font Awesome
How to introduce jQuery in Rails 6
[Rails] How to implement star rating
How to get along with Rails
[Introduction to Rails] How to use render
How to install Swiper in Rails
How to implement search functionality in Rails
How to change app name in rails
[Ruby on Rails] How to use CarrierWave
[Rails] How to convert from erb to haml
[Rails] How to upload images using Carrierwave
[Rails] How to use rails console with docker
How to insert a video in Rails
[Rails] How to display error messages individually
How to use MySQL in Rails tutorial
[Ruby on Rails] How to use redirect_to
[Rails 5.x] How to introduce free fonts
How to implement ranking functionality in Rails
[Note] How to use Rails 6 Devise + cancancan