Skip to content

Commit

Permalink
add term to inquiry
Browse files Browse the repository at this point in the history
  • Loading branch information
bemky committed Oct 9, 2017
1 parent 96e4f7d commit bcb0bde
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/mls/inquiry.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class Inquiry < MLS::Model

TERMS = %w(<1 1-2 3-5 5+ flexible)

has_many :emails
belongs_to :subject, polymorphic: true
Expand All @@ -9,6 +11,20 @@ class Inquiry < MLS::Model
def property
subject.is_a? MLS::Model::Listing ? subject.property : subject
end

def term_units(value=nil)
value ||= self.term
case value
when "<1"
"year"
when "flexible"
""
when nil
""
else
"years"
end
end

def account_attributes=(account_attrs)
account_attrs = account_attrs&.with_indifferent_access
Expand Down

0 comments on commit bcb0bde

Please sign in to comment.