Class: Stay::Seeds::Stores

Inherits:
Object
  • Object
show all
Defined in:
app/services/stay/seeds/stores.rb

Class Method Summary collapse

Class Method Details

.callObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/services/stay/seeds/stores.rb', line 7

def self.call
  default_store = Stay::Store.default
  default_country_id = Stay::Country.find_by(iso: 'US')&.id

  if default_store.persisted?
    default_store.update!(default_country_id: Stay::Config[:default_country_id])
  else
    Stay::Store.new do |s|
      s.name                         = 'Stay Commerce'
      s.code                         = 'Stay'
      s.url                          = Rails.application.routes.default_url_options[:host]
      s.mail_from_address            = '[email protected]'
      s.customer_support_email       = '[email protected]'
      s.default_currency             = 'USD'
      s.default_country_id           = default_country_id
      s.default_locale               = 'en'
      s.default                      = true
      s.seo_title                    = 'Stay Commerce Demo'
      s.meta_description             = 'This is the new Stay UX DEMO '
      s.facebook                     = 'staycommerce'
      s.twitter                      = 'staycommerce'
      s.instagram                    = 'staycommerce'
    end.save!
  end
end