Class: ActionView::Helpers::FormBuilder
Attributes
| Name | Read/write? |
|---|---|
| object | RW |
| object_name | RW |
| options | RW |
Public Class Methods
new (object_name, object, template, options, proc)
# File vendor/rails/actionpack/lib/action_view/helpers/form_helper.rb, line 640 640: def initialize(object_name, object, template, options, proc) 641: @object_name, @object, @template, @options, @proc = object_name, object, template, options, proc 642: @default_options = @options ? @options.slice(:index) : {} 643: end
Public Instance Methods
check_box (method, options = {}, checked_value = "1", unchecked_value = "0")
# File vendor/rails/actionpack/lib/action_view/helpers/form_helper.rb, line 676 676: def check_box(method, options = {}, checked_value = "1", unchecked_value = "0") 677: @template.check_box(@object_name, method, objectify_options(options), checked_value, unchecked_value) 678: end
collection_select (method, collection, value_method, text_method, options = {}, html_options = {})
# File vendor/rails/actionpack/lib/action_view/helpers/form_options_helper.rb, line 438 438: def collection_select(method, collection, value_method, text_method, options = {}, html_options = {}) 439: @template.collection_select(@object_name, method, collection, value_method, text_method, options.merge(:object => @object), html_options) 440: end
country_select (method, priority_countries = nil, options = {}, html_options = {})
# File vendor/rails/actionpack/lib/action_view/helpers/form_options_helper.rb, line 442 442: def country_select(method, priority_countries = nil, options = {}, html_options = {}) 443: @template.country_select(@object_name, method, priority_countries, options.merge(:object => @object), html_options) 444: end
date_select (method, options = {}, html_options = {})
# File vendor/rails/actionpack/lib/action_view/helpers/date_helper.rb, line 697 697: def date_select(method, options = {}, html_options = {}) 698: @template.date_select(@object_name, method, options.merge(:object => @object)) 699: end
datetime_select (method, options = {}, html_options = {})
# File vendor/rails/actionpack/lib/action_view/helpers/date_helper.rb, line 705 705: def datetime_select(method, options = {}, html_options = {}) 706: @template.datetime_select(@object_name, method, options.merge(:object => @object)) 707: end
error_message_on (method, prepend_text = "", append_text = "", css_class = "formError")
# File vendor/rails/actionpack/lib/action_view/helpers/form_helper.rb, line 684 684: def error_message_on(method, prepend_text = "", append_text = "", css_class = "formError") 685: @template.error_message_on(@object, method, prepend_text, append_text, css_class) 686: end
error_messages (options = {})
# File vendor/rails/actionpack/lib/action_view/helpers/form_helper.rb, line 688 688: def error_messages(options = {}) 689: @template.error_messages_for(@object_name, objectify_options(options)) 690: end
fields_for (record_or_name_or_array, *args, &block)
# File vendor/rails/actionpack/lib/action_view/helpers/form_helper.rb, line 655 655: def fields_for(record_or_name_or_array, *args, &block) 656: case record_or_name_or_array 657: when String, Symbol 658: name = "#{object_name}[#{record_or_name_or_array}]" 659: when Array 660: object = record_or_name_or_array.last 661: name = "#{object_name}[#{ActionController::RecordIdentifier.singular_class_name(object)}]" 662: args.unshift(object) 663: else 664: object = record_or_name_or_array 665: name = "#{object_name}[#{ActionController::RecordIdentifier.singular_class_name(object)}]" 666: args.unshift(object) 667: end 668: 669: @template.fields_for(name, *args, &block) 670: end
label (method, text = nil, options = {})
# File vendor/rails/actionpack/lib/action_view/helpers/form_helper.rb, line 672 672: def label(method, text = nil, options = {}) 673: @template.label(@object_name, method, text, objectify_options(options)) 674: end
radio_button (method, tag_value, options = {})
# File vendor/rails/actionpack/lib/action_view/helpers/form_helper.rb, line 680 680: def radio_button(method, tag_value, options = {}) 681: @template.radio_button(@object_name, method, tag_value, objectify_options(options)) 682: end
select (method, choices, options = {}, html_options = {})
# File vendor/rails/actionpack/lib/action_view/helpers/form_options_helper.rb, line 434 434: def select(method, choices, options = {}, html_options = {}) 435: @template.select(@object_name, method, choices, options.merge(:object => @object), html_options) 436: end
submit (value = "Save changes", options = {})
# File vendor/rails/actionpack/lib/action_view/helpers/form_helper.rb, line 692 692: def submit(value = "Save changes", options = {}) 693: @template.submit_tag(value, options.reverse_merge(:id => "#{object_name}_submit")) 694: end
time_select (method, options = {}, html_options = {})
# File vendor/rails/actionpack/lib/action_view/helpers/date_helper.rb, line 701 701: def time_select(method, options = {}, html_options = {}) 702: @template.time_select(@object_name, method, options.merge(:object => @object)) 703: end
time_zone_select (method, priority_zones = nil, options = {}, html_options = {})
# File vendor/rails/actionpack/lib/action_view/helpers/form_options_helper.rb, line 446 446: def time_zone_select(method, priority_zones = nil, options = {}, html_options = {}) 447: @template.time_zone_select(@object_name, method, priority_zones, options.merge(:object => @object), html_options) 448: end
Private Instance Methods
objectify_options (options)
# File vendor/rails/actionpack/lib/action_view/helpers/form_helper.rb, line 697 697: def objectify_options(options) 698: @default_options.merge(options.merge(:object => @object)) 699: end