prisskreative
11/16/2016 - 10:42 PM

React Rails crud interface

React Rails crud interface

New rails app

rails new rails-react-crud-interface --skip-bundle --skip-turbolinks --database=postgresql
cd rails-react-crud-interface
bundle install

rake db:create
rake db:migrate
rails g model Item name:string description:text
rake db:migrate


---------

git init
git add .
git commit -m "Rails app with postresSQL"
git status

Create repo on github website

git remote add origin https://github.com/prisskreative/rails-react-crud-interface.git
git push -u origin master


--------


#db/seeds.rb 

10.times { Item.create!(name: "Item", description: "I am a description.") }


rake db:seed


--------

# Making the code DRY-er
gem 'responders', '~> 2.0'

bundle


-------

Second, we’ll make a small adjustment to the application controller. Except throwing an exception, we’ll make the controller throw a null session because we’re going to request json, which is different to the html (which is requested by default).

#application_controller.rb


class ApplicationController < ActionController::Base
  protect_from_forgery with: :null_session
end