Sha256: 77102b04afd6e4a4a9ab51d8614502bd6682f58b8b239347fe0583e15d8c020e

Contents?: true

Size: 596 Bytes

Versions: 8

Compression:

Stored size: 596 Bytes

Contents

module SettingsHelper

  # eg.
  # setting("blog/per_page", 20, :kind => :integer) 
  def get_setting(namespaced_key, *args)
    namespace_separator = "/"
    
    opts = args.extract_options!
    value = args.first
    namespaced_key = namespaced_key.to_s
    group, key =  namespaced_key.include?(namespace_separator) ? namespaced_key.split(namespace_separator) : [nil, namespaced_key]
    
    Setting.global("#{key}", :autocreate => (opts[:autocreate].nil? ? true : opts[:autocreate]), :kind => opts[:kind], :default => value, :group => group)
  end
  
  alias :setting :get_setting
  
end


Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fullstack-cms-0.1.14 app/helpers/settings_helper.rb
fullstack-cms-0.1.13 app/helpers/settings_helper.rb
fullstack-cms-0.1.12 app/helpers/settings_helper.rb
fullstack-cms-0.1.11 app/helpers/settings_helper.rb
fullstack-cms-0.1.9 app/helpers/settings_helper.rb
fullstack-cms-0.1.8 app/helpers/settings_helper.rb
fullstack-cms-0.1.7 app/helpers/settings_helper.rb
fullstack-cms-0.1.6 app/helpers/settings_helper.rb