Module: ActionView::Helpers::ActiveModelInstanceTag
| Relationships & Source Files | |
| Extension / Inclusion / Inheritance Descendants | |
|
Included In:
Tags::Base,
Tags::CheckBox,
Tags::CollectionCheckBoxes,
Tags::CollectionRadioButtons,
Tags::CollectionSelect,
Tags::ColorField,
Tags::DateField,
Tags::DateSelect,
Tags::DatetimeField,
Tags::DatetimeLocalField,
Tags::DatetimeSelect,
Tags::EmailField,
Tags::FileField,
Tags::GroupedCollectionSelect,
Tags::HiddenField,
Tags::Label,
Tags::MonthField,
Tags::NumberField,
Tags::PasswordField,
Tags::RadioButton,
Tags::RangeField,
Tags::SearchField,
Tags::Select,
Tags::TelField,
Tags::TextArea,
Tags::TextField,
Tags::TimeField,
Tags::TimeSelect,
Tags::TimeZoneSelect,
Tags::UrlField,
Tags::WeekField,
Tags::WeekdaySelect
| |
| Defined in: | actionview/lib/action_view/helpers/active_model_helper.rb |
Overview
Active Model Instance Tag Helpers
Instance Attribute Summary
- #object_has_errors? ⇒ Boolean readonly private
Instance Method Summary
Instance Attribute Details
#object_has_errors? ⇒ Boolean (readonly, private)
[ GitHub ]
Instance Method Details
#content_tag(type, options)
[ GitHub ]# File 'actionview/lib/action_view/helpers/active_model_helper.rb', line 20
def content_tag(type, , *) select_markup_helper?(type) ? super : error_wrapping(super) end
#error_message
[ GitHub ]# File 'actionview/lib/action_view/helpers/active_model_helper.rb', line 36
def object.errors[@method_name] end
#error_wrapping(html_tag)
[ GitHub ]# File 'actionview/lib/action_view/helpers/active_model_helper.rb', line 28
def error_wrapping(html_tag) if object_has_errors? @template_object.instance_exec(html_tag, self, &Base.field_error_proc) else html_tag end end
#object
[ GitHub ]# File 'actionview/lib/action_view/helpers/active_model_helper.rb', line 13
def object @active_model_object ||= begin object = super object.respond_to?(:to_model) ? object.to_model : object end end
#select_markup_helper?(type) ⇒ Boolean (private)
# File 'actionview/lib/action_view/helpers/active_model_helper.rb', line 45
def select_markup_helper?(type) ["optgroup", "option"].include?(type) end
#tag(type, options)
[ GitHub ]# File 'actionview/lib/action_view/helpers/active_model_helper.rb', line 24
def tag(type, , *) tag_generate_errors?() ? error_wrapping(super) : super end
#tag_generate_errors?(options) ⇒ Boolean (private)
# File 'actionview/lib/action_view/helpers/active_model_helper.rb', line 49
def tag_generate_errors?() ["type"] != "hidden" end