Permalink
Browse files

Changed view helper to work with Rails 3.

Helpers#to_tag was removed from it.
  • Loading branch information...
1 parent 971772e commit b8e9c12518998566634f1fe9198f48981e504c7b @lailsonbm lailsonbm committed Jun 4, 2010
Showing with 12 additions and 10 deletions.
  1. +12 −10 lib/enumerated_attribute/rails_helpers.rb
@@ -72,17 +72,19 @@ def to_enum_select_tag(options, html_options={})
end
#initialize record_name, method, self
- def to_tag_with_enumerated_attribute(options={})
- #look for an enum
- if (column_type == :string &&
- self.object.class.respond_to?(:has_enumerated_attribute?) &&
- self.object.class.has_enumerated_attribute?(method_name.to_sym))
- to_enum_select_tag(options)
- else
- to_tag_without_enumerated_attribute(options)
- end
+ if respond_to?(:to_tag)
+ def to_tag_with_enumerated_attribute(options={})
+ #look for an enum
+ if (column_type == :string &&
+ self.object.class.respond_to?(:has_enumerated_attribute?) &&
+ self.object.class.has_enumerated_attribute?(method_name.to_sym))
+ to_enum_select_tag(options)
+ else
+ to_tag_without_enumerated_attribute(options)
+ end
+ end
+ alias_method_chain :to_tag, :enumerated_attribute
end
- alias_method_chain :to_tag, :enumerated_attribute
end
class FormBuilder

0 comments on commit b8e9c12

Please sign in to comment.