Created
February 1, 2013 18:05
-
-
Save sllvn/4692975 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Contract < ActiveRecord::Base | |
# attr_accessible :title, :body | |
belongs_to :contract_type | |
has_many :contract_terms | |
def display_name | |
"#{self.contract_type.name}: #{self.person_name}" | |
end | |
def person_name | |
# todo: this seems inefficient, do we want to throw important metadata in the | |
# contract record itself rather than extract from terms each time? | |
name = self.contract_terms.select { |t| t.field == "Performer" }.first.value | |
name = "N/A" if name == "" | |
name | |
end | |
def display_date | |
self.date_created.strftime("%Y-%m-%d") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment