begin29
5/5/2016 - 2:30 PM

Rails commands

Rails commands

rails g model Supplier name:string
rails g model Product name:string:index sku:string{10}:uniq count:integer description:text supplier:references popularity:float 'price:decimal{10,2}' available:boolean availableSince:datetime image:binary
# https://www.ralfebert.de/snippets/ruby-rails/models-tables-migrations-cheat-sheet/
# copy migrations from engine
rake railties:install:migrations

# record not new/new
persisted? # new_record?

# execute query in console
ActiveRecord::Base.connection.execute("foo")

# string to class
"Class Name".constantize

# Rails console history file
~/.irb-history