Class: Spree::Retailer
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Spree::Retailer
- Defined in:
- app/models/spree/retailer.rb
Instance Method Summary collapse
- #full_address ⇒ Object
- #geocode? ⇒ Boolean
- #geocoded? ⇒ Boolean
- #has_logo? ⇒ Boolean
- #has_url? ⇒ Boolean
- #url=(value) ⇒ Object
Instance Method Details
#full_address ⇒ Object
43 44 45 |
# File 'app/models/spree/retailer.rb', line 43 def full_address "#{address} #{address2} #{city}, #{state} #{zipcode}" end |
#geocode? ⇒ Boolean
47 48 49 |
# File 'app/models/spree/retailer.rb', line 47 def geocode? (new_record? || changed?) && !address.blank? end |
#geocoded? ⇒ Boolean
51 52 53 |
# File 'app/models/spree/retailer.rb', line 51 def geocoded? geokit_success && !(latitude.nil? || longitude.nil?) end |
#has_logo? ⇒ Boolean
31 32 33 |
# File 'app/models/spree/retailer.rb', line 31 def has_logo? !self.logo_file_name.blank? end |
#has_url? ⇒ Boolean
27 28 29 |
# File 'app/models/spree/retailer.rb', line 27 def has_url? !(self.url.nil? || self.url.empty? || self.url == "http://") end |
#url=(value) ⇒ Object
35 36 37 38 39 40 41 |
# File 'app/models/spree/retailer.rb', line 35 def url=(value) val = value.to_s.strip.downcase if val.match(/^http(s)?:\/\//) == nil val = "http://" + val end write_attribute :url, val end |