Class: ActionView::Helpers::FormBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/cancan_edit/edit_additions.rb

Instance Method Summary collapse

Instance Method Details

#check_box_with_cancan(method, options = {}, checked_value = "1", unchecked_value = "0") ⇒ Object



12
13
14
15
# File 'lib/cancan_edit/edit_additions.rb', line 12

def check_box_with_cancan(method, options = {}, checked_value = "1", unchecked_value = "0")
  options.merge!({:disabled => true}) unless (@template.can_edit? method.to_sym, @object) 
  check_box_without_cancan(method, options, checked_value = "1", unchecked_value = "0")
end

#radio_button_with_cancan(method, tag_value, options = {}) ⇒ Object



18
19
20
21
# File 'lib/cancan_edit/edit_additions.rb', line 18

def radio_button_with_cancan(method, tag_value, options = {})
  options.merge!({:disabled => true}) unless (@template.can_edit? method.to_sym, @object)
  radio_button_without_cancan(method, tag_value, options)    
end