Method: Fullstack::Cms::Configuration#setting

Defined in:
lib/fullstack/cms/configuration.rb

#setting(key, options = {}) ⇒ Object

config.setting(‘description’, :kind => :text, :localized => true, :group => group) setting(‘website/description’, :locale => I18n.locale)



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/fullstack/cms/configuration.rb', line 58

def setting(key, options = {})
  return nil unless Setting.table_exists?

  options = options.reverse_merge({ :localized => localized? }).merge({ :autocreate => true })
  localized_setting = options.delete(:localized)

  if localized_setting && localized? # ignores the option if CMS is not localized
    I18n.available_locales.each do |locale|
      Setting.global(key.to_s, options.merge(:locale => locale.to_s))
    end
  else
    Setting.global(key.to_s, options)
  end


end