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 *
-doption is to specify a database-Toption to skip unit test framework, files--webpackto configure javascript frame for webpack bundler here it'sreact--skip-coffeeto skipcoffescript--skip-active-storageto skipactive-storagerelated 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:installto initrspecralted config and folder structure.
- Add
-
Setting up Database
- Run
rails db:migrateto setup the schema - Run
bin/setupto setup the database
- Run
-
Setting up react components
- Run
mkdir app/javascript/componentsto make directory forreactcomponents. - Run
touch app/javscript/packs/index.jsto make entry point forreactcomponents. - Import a root component and load in
indexpack.
- Run