Sha256: 032a711b771c2da7ffcf16d8d59e5d057af56920f1ccfc749bf11e2d96773fb7
Contents?: true
Size: 872 Bytes
Versions: 3
Compression:
Stored size: 872 Bytes
Contents
module ActionView module Helpers def setting_check_box(model_name, method, options = {}, checked_value = "1", unchecked_value = "0") the_model = @template.instance_variable_get("@#{model_name}") throw "setting_check_box only work on models with settings" unless the_model.respond_to?(:settings) options[:checked] = the_model.settings.send("#{method}?") options[:id] ||= "#{model_name}_settings_#{method}" options[:name] = "#{model_name}[settings][#{method}]" @template.check_box(model_name, "settings_#{method}", options, checked_value, unchecked_value) end class FormBuilder def setting_check_box(method, options = {}, checked_value = "1", unchecked_value = "0") @template.setting_check_box(@object_name, method, objectify_options(options), checked_value, unchecked_value) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
has_settings-0.0.4 | lib/has_settings/has_settings_helper.rb |
has_settings-0.0.3 | lib/has_settings/has_settings_helper.rb |
has_settings-0.0.1 | lib/has_settings/has_settings_helper.rb |