This is written on 10/November/2019
The database is postgres
-
rails new rails_app -d=postgresql -T --webpack=react --skip-coffee --skip-active-storage *
-d
option is to specify a database-T
option to skip unit test framework, files--webpack
to configure javascript frame for webpack bundler here it'sreact
--skip-coffee
to skipcoffescript
--skip-active-storage
to skipactive-storage
related things.
This gives us the rails app useful to build a webpack with react front end and ruby on rails backend
-
Adding rspec to rails
- Add
gem 'rspec-rails'
toGemfile
- Run
bundle install
- Run this command
rails generate rspec:install
to initrspec
ralted config and folder structure.
- Add
-
Setting up Database
- Run
rails db:migrate
to setup the schema - Run
bin/setup
to setup the database
- Run
-
Setting up react components
- Run
mkdir app/javascript/components
to make directory forreact
components. - Run
touch app/javscript/packs/index.js
to make entry point forreact
components. - Import a root component and load in
index
pack.
- Run