-
Notifications
You must be signed in to change notification settings - Fork 0
rails Notes
- General Notes
- Benchmarking
- Rails Notes
- Useful Commands
- rails / Working with Databases
- rails 5 / General Notes
- General Useful Links
- rails follows the convention over configuration software design paradigm.
- rails v4.0 requires ruby >= 1.9.2
A pictorial πΈ diagram explaining rails
- model name is singular, ie.
mr_fancy_pant.rb - database table name is plural, ie.
mr_fancy_pants - migration files should follow the plural naming convention, ie.
20140528053443_create_mr_fancy_pants.rb
Benchmarking RVM Ruby 2.3.1, rails 4.2.x, execjs & rubyracer
Benchmarking RVM Ruby 2.5.3, rails 4.2.10, Node.js
- rails defaults to the system encoding which is UTF-8 the majority of the time.
- Generally it's a good idea to check and make sure databases have been created before trying to deploy a rails app.
to put a multiline comment in a .html.erb file
<% if false %>
multiline
comment
in an erb template file
<% end %>
<%-# single line erb comment -%>Rails version 5 has migrated from using
raketorails
To install rails with no documentation
gem install rails --no-ri --no-rdocThree types of database relationship asociations
- one-to-one
- one-to-many
- many-to-many
To test the database connection
bundle exec rake db:schema:dumpTo undo all migrations applied to a database
β οΈ All data in the database will be dropped, ie. deleted
bundle exec rake db:migrate VERSION=0To get a list of all the migrations and their status
bundle exec rake db:migrate:statusTo reset the database to its starting point
bundle exec rake db:migrate:resetTo create / setup databases for a rails version 4 app
rake db:create:allTo run all the migrations for the DB
rake db:migrateTo show the status of the migrations, ie. whether they have been applied or not
rake db:migrate:statusTo remove a migration file
rails destroy migration 20140528053443_create_mr_fancy_pants.rbTo rollback one migration
rake db:rollbackTo clear the contents of the DB
rake db:resetTo create a rails project without a test suite
rails new [project_name] -TTo delete a model
rails destroy model [model_name]rails 5 requires Ruby >= 2.2.2 the
railscommand replacesrakein rails 5
- The development server switched from WEBrick to Puma
- ActionCable is a framework for working with WebSockets
To create a new rails app that acts as a JSON API
rails new mr_fancy_pants_api --apiTo remove border radius from a navbar, see
π¬blog post > rolling your own file attachment
- codeschool > Token Based Authentication in Rails
- building awesome rails API
- Building a RESTful API in a Rails Application
- railscasts > Securing an API
To show a an IRC users activity in the #rubyonrails channel on freenode
http://logs.ryanbigg.com/p/$USER/activity