Searching a Database in Rails
For searching your database, ActiveRecord (AR) provides many methods – some generated automatically based on your tables. The most basic way to find an object is with calling the class method ‘find’ on your model. find, by default, takes the id(s) of the record you’re looking for as an argument.
User.find(1)
User.find(1, 7, 14)
You can find the [...]
Rails Migration Data Types
Had someone ask where to find the available data types for Rails migrations today – and thought it would be good to keep a copy for my own reference. Heres the list:
Rails -> MySQL
:binary -> blob
:boolean -> tinyint(1)
:date -> date
:datetime ->datetime
:decimal -> decimal
:float ->float
:integer -> int(11)
:string -> varchar(255)
:text -> text
:timestamp -> datetime
:time -> time