Skip to content

Instantly share code, notes, and snippets.

View kalleth's full-sized avatar

Tom Russell kalleth

View GitHub Profile
class Foo < ActiveRecord::Base
after_initialize :do_stuff
def do_stuff
self.parameter = "string" if self.parameter.nil?
end
end
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