Created
October 6, 2010 11:52
-
-
Save beerlington/613235 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ClassyEnumHelper | |
class SemanticFormBuilder < Formtastic::SemanticFormBuilder | |
def enum_select_input(method, options) | |
enum_class = object.send(method) | |
unless enum_class.respond_to? :base_class | |
raise "#{method} does not refer to a defined ClassyEnum object" | |
end | |
options[:collection] = enum_class.base_class.all_with_name | |
options[:selected] = enum_class.to_s | |
select_input(method, options) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment