Generate
rails new app_name
run
rails server
Test
rails test
or
rake test
Generate controlers. This is about, with about method
rails generate controller about about
Generate models:
rails generate model Lesson name:string description:text
Model with references
rails g model dish name:string rating:integer restaurant:references
Generate resource:
rails generate resource entry title:string body:text published:boolean
Generate serializers
rails g serializer category
jsonapi-rb:
rails generate jsonapi:serializable tag
Check routes:
rails routes
Then:
rake db:migrate
for other envs:
export RAILS_ENV=production
rake db:migrate
Populate the Database
rake db:seed
curl http://localhost:3000/courses
curl --header "Content-Type: application/json" \
--request POST \
--data '{"title":"xyz","description":"xyz", "published": "false"}' \
http://localhost:3000/courses
curl -i -X POST -H "Content-Type: application/json" -d '{"title":"xyz","description":"xyz", "published": "false"}' http://localhost:3000/courses
insert into courses (title, description, published, created_at, updated_at) values ("aaa", "aaa description" , false, DATE('now'), DATE('now'));
-
Ruby version
-
System dependencies
-
Configuration
-
Database creation
-
Database initialization
-
How to run the test suite
-
Services (job queues, cache servers, search engines, etc.)
-
Deployment instructions
-
...