Note: Cheat sheet when creating Rails Vue app

app creation command

rails version new app name-d mysql --webpacker=vue --skip-turbolinks

Gem list to add

gem 'devise'
gem 'devise-i18n'
gem 'rails-i18n'

gem 'faker'
gem 'factory_bot_rails'

gem 'rubocop', require: false
gem 'rubocop-rails', require: false
gem 'pry'
gem 'pry-doc'
gem 'pry-rails'
gem 'pry-byebug'
gem 'foreman'

gem 'rspec-rails', '~> 4.0.0'
gem 'rubocop-rspec', require: false

Execution command

$ rails webpacker:install

$ rails webpacker:install:vue

$ yarn add axios

$ yarn add vue-router

$ rails g rspec:install

$ rails g devise:install

rspec settings

.rspec


--require spec_helper
--format documentation

foreman settings

Profile.dev


web: bundle exec rails s
# watcher: ./bin/webpack-watcher
hot: ./bin/webpack-dev-server

bin/server


#!/bin/bash -i
bundle install
bundle exec foreman start -f Procfile.dev
$ chmod 777 bin/server

Setting not to create files that do not need Japanese support

config/application.rb


config.i18n.default_locale = :ja
config.time_zone = "Tokyo"

config.generators do |g|
  g.template_engine false 
  g.assets false
  g.helper false
  g.test_framework :rspec,
                    fixtures: false,
                    view_specs: false,
                    helper_specs: false,
                    routing_specs: false
end

Frequently used creation commands

$ rails g api/v1/Controller name index

$rails g model model name title:string likable:references{polymorphic}

#rails new time
$ bundle config --local build.mysql2 "--with-ldflags=-L/usr/local/opt/openssl/lib"

Recommended Posts

Note: Cheat sheet when creating Rails Vue app
Rails Tutorial cheat sheet
Rough procedure verbalized output when creating an app with Rails
Summary of initial work when creating an app with Rails
How to specify db when creating an app with rails
Note: Rails View cheat sheet used at a certain school (under construction)
Java cheat sheet
JMeter cheat sheet
Rails Credentials Note
Kotlin cheat sheet
[Docker cheat sheet]
How to get started with creating a Rails app