Skip to content
Snippets Groups Projects
Commit 8e1b143f authored by Simon Hürlimann's avatar Simon Hürlimann
Browse files

Fix InsurancePolicy module to not generate stack overflows.

parent 128d0204
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@ class InsurancePolicy < ActiveRecord::Base
# Scopes
scope :by_policy_type, lambda {|policy_type|
{:conditions => {:policy_type => policy_type}}
where(:policy_type => policy_type)
}
# Associations
......@@ -15,10 +15,15 @@ class InsurancePolicy < ActiveRecord::Base
# Validations
# validates_presence_of :insurance
def to_s
s = "#{policy_type}: #{insurance.to_s}"
s += " ##{number}" unless number.blank?
def to_s(format = :default)
ident = insurance.to_s
ident += " ##{number}" unless number.blank?
return s
case format
when :long
return "#{policy_type}: #{ident}"
else
return ident
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment