Module: ActionView::Helpers
- Defined in:
- lib/features/features_helper.rb
Defined Under Namespace
Classes: FormBuilder
Instance Method Summary collapse
Instance Method Details
#feature_check_box(model_name, method, options = {}, checked_value = "1", unchecked_value = "0") ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/features/features_helper.rb', line 3 def feature_check_box(model_name, method, = {}, checked_value = "1", unchecked_value = "0") account = @template.instance_variable_get("@#{model_name}") throw "feature_check_box only work on models with features" unless account.respond_to?(:features) [:checked] = account.features.send("#{method}?") [:id] ||= "#{model_name}_features_#{method}" [:name] = "#{model_name}[features][#{method}]" @template.check_box(model_name, "features_#{method}", , checked_value, unchecked_value) end |