Class: WorthSaving::FormBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/worth_saving/form_builder.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_form_idObject



43
44
45
46
# File 'lib/worth_saving/form_builder.rb', line 43

def self.next_form_id
  @@worth_saving_form_id ||= 0
  @@worth_saving_form_id += 1
end

Instance Method Details

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



13
14
15
16
# File 'lib/worth_saving/form_builder.rb', line 13

def check_box(method, options = {}, checked_value = "1", unchecked_value = "0")
  process_options! method, options
  super
end

#fields_for(record_name, options = {}, &bloc) ⇒ Object



33
34
35
36
# File 'lib/worth_saving/form_builder.rb', line 33

def fields_for(record_name, options = {}, &bloc)
  options[:builder] = options[:builder].superclass unless object.worth_saving? record_name
  super
end

#hidden_field(method, options = {}) ⇒ Object



28
29
30
31
# File 'lib/worth_saving/form_builder.rb', line 28

def hidden_field(method, options = {})
  process_options! method, options
  super
end

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



8
9
10
11
# File 'lib/worth_saving/form_builder.rb', line 8

def radio_button(method, tag_value, options = {})
  process_options! method, options
  super
end

#select(method, choices, options = {}, html_options = {}) ⇒ Object



23
24
25
26
# File 'lib/worth_saving/form_builder.rb', line 23

def select(method, choices, options = {}, html_options = {})
  process_options! method, html_options
  super
end

#submit(value = nil, options = {}) ⇒ Object



38
39
40
41
# File 'lib/worth_saving/form_builder.rb', line 38

def submit(value = nil, options = {})
  value = 'Choose this copy' if self.options[:worth_saving_recovery]
  super
end

#text_area(method, options = {}) ⇒ Object



18
19
20
21
# File 'lib/worth_saving/form_builder.rb', line 18

def text_area(method, options = {})
  process_options! method, options
  super
end

#text_field(method, options = {}) ⇒ Object



3
4
5
6
# File 'lib/worth_saving/form_builder.rb', line 3

def text_field(method, options = {})
  process_options! method, options
  super
end