This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo < ActiveRecord::Base | |
after_initialize :do_stuff | |
def do_stuff | |
self.parameter = "string" if self.parameter.nil? | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Account < ActiveRecord::Base | |
has_many :users | |
accepts_nested_attributes_for :users | |
serialize :account #If you want to store the recurly account, you need to serialise the object | |
validates_presence_of :company, :on => :create, :message => "can't be blank" | |
# Before_create will be called once only | |
before_create :create_external_account |
NewerOlder