Skip to content

Instantly share code, notes, and snippets.

@beerlington
Created October 6, 2010 11:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beerlington/613235 to your computer and use it in GitHub Desktop.
Save beerlington/613235 to your computer and use it in GitHub Desktop.
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