Class: ActionView::Helpers::InstanceTag
- Inherits:
-
Object
- Object
- ActionView::Helpers::InstanceTag
- Defined in:
- lib/enum/active_record_helper.rb
Instance Method Summary collapse
- #to_enum_select_tag(options, html_options = {}) ⇒ Object
- #to_tag_with_enumerated_attribute(options = {}) ⇒ Object
Instance Method Details
#to_enum_select_tag(options, html_options = {}) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/enum/active_record_helper.rb', line 28 def to_enum_select_tag(, ={}) if self.object.respond_to?(method_name.to_sym) column = self.object.column_for_attribute(method_name) if (value = self.object.__send__(method_name.to_sym)) [:selected] ||= value.to_s else [:include_blank] = column.null if [:include_blank].nil? end end to_select_tag(column.limit, , ) end |
#to_tag_with_enumerated_attribute(options = {}) ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/enum/active_record_helper.rb', line 42 def to_tag_with_enumerated_attribute(={}) #look for an enum if (column_type == :enum && self.object.class.respond_to?(method_name.to_sym)) to_enum_select_tag() else to_tag_without_enumerated_attribute() end end |