Ruby Version 5.0
-
System dependencies
-
Configuration
-
Database creation
-
Database initialization
-
How to run the test suite
-
Services (job queues, cache servers, search engines, etc.)
-
Deployment instructions
rails new cheatsheet -d postgresql
bundle install
rails g devise:install
rails g controller home index
rails g devise User
rails db:create db:migrate
rails g devise:views
Add this code fragment to /app/models/user.rb.
before_action :authenticate_user!
#user:belongs_to could also be written user:references
rails g model vendor user:belongs_to first_name:string last_name:string gender:string birthdate:date occuptation:string city:string state:string zip_code:string --force
Create a vanilla home controller
rails g controller home index
Run a server using a custom task
rails server:start
Custom task to wipe the database
rails db:wipe
Validate a Ranking
validates_numericality_of :rating, :greater_than_or_equal_to => 0.0, :less_than_or_equal_to => 10.0