Class: Spree::Retailer

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/spree/retailer.rb

Instance Method Summary collapse

Instance Method Details

#full_addressObject



43
44
45
# File 'app/models/spree/retailer.rb', line 43

def full_address
  "#{address} #{address2} #{city}, #{state} #{zipcode}"
end

#geocode?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'app/models/spree/retailer.rb', line 47

def geocode?
  (new_record? || changed?) && !address.blank?
end

#geocoded?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'app/models/spree/retailer.rb', line 51

def geocoded?
  geokit_success && !(latitude.nil? || longitude.nil?)
end

#has_logo?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'app/models/spree/retailer.rb', line 31

def has_logo?
  !self.logo_file_name.blank?
end

#has_url?Boolean

Returns:

  • (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