This is an awesome link on how to setup attributes on ActiveRecord

LINK: 5-ways to set attributes

And I want to mention one trick about active record:

When we try to assign a value to active record object like

class A < ActiveRecord
  attr_accessible :t_attr

  def some_method
    t_attr = "value" # this will create a local variable with t_attr.
    puts self.t_attr # nil, value is not assigned to object's attribute
    puts t_attr   # "value", local variable defined within "some_method" method
    # so when assigning a value to objec attribute, we need to explicitly add the self.
    self.t_attr = "value" # This will assign the proper value to attribute.
  end

end

In case of any queries, post your queries in comments.