Skip to content

Instantly share code, notes, and snippets.

@gareth
Created October 17, 2011 14:24
Show Gist options
  • Save gareth/1292703 to your computer and use it in GitHub Desktop.
Save gareth/1292703 to your computer and use it in GitHub Desktop.
class Project < ActiveRecord::Base
has_many :goals
end
class Goal < ActiveRecord::Base
belongs_to :project
class << self
def setup *some_fields
new.tap do |goal|
# Some processing based on some_fields
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment