added method location= and revised location to handle missing fields better
This commit is contained in:
parent
0425a9d389
commit
d2ebfbde4f
|
|
@ -106,7 +106,18 @@ module JamRuby
|
|||
end
|
||||
|
||||
def location
|
||||
return "#{self.city}, #{self.state}, #{self.country}"
|
||||
loc = self.city.blank? ? '' : self.city
|
||||
loc = loc.blank? ? self.state : "#{loc}, #{self.state}" unless self.state.blank?
|
||||
loc = loc.blank? ? self.country : "#{loc}, #{self.country}" unless self.country.blank?
|
||||
loc
|
||||
end
|
||||
|
||||
def location= location_hash
|
||||
unless location_hash.blank?
|
||||
self.city = location_hash[:city]
|
||||
self.state = location_hash[:state]
|
||||
self.country = location_hash[:country]
|
||||
end if self.city.blank?
|
||||
end
|
||||
|
||||
def should_validate_password?
|
||||
|
|
|
|||
Loading…
Reference in New Issue