Skip to content

Commit

Permalink
Fix for simple_form 2 supporting 1 as well
Browse files Browse the repository at this point in the history
  • Loading branch information
adzap committed Jun 1, 2012
1 parent 49e7e9c commit 14d3f33
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/active_enum/form_helpers/simple_form.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'simple_form/version'

module ActiveEnum
module FormHelpers
module SimpleForm
Expand All @@ -12,7 +14,7 @@ def default_input_type_with_active_enum(*args, &block)

end

class EnumInput < ::SimpleForm::Inputs::CollectionInput
module InputExtension

def initialize(*args)
super
Expand All @@ -29,6 +31,16 @@ def initialize(*args)
end
end

if SimpleForm::VERSION < '2.0.0'
class ActiveEnum::FormHelpers::SimpleForm::EnumInput < ::SimpleForm::Inputs::CollectionInput
include ActiveEnum::FormHelpers::SimpleForm::InputExtension
end
else
class ActiveEnum::FormHelpers::SimpleForm::EnumInput < ::SimpleForm::Inputs::CollectionSelectInput
include ActiveEnum::FormHelpers::SimpleForm::InputExtension
end
end

SimpleForm::FormBuilder.class_eval do
include ActiveEnum::FormHelpers::SimpleForm::BuilderExtension

Expand Down

0 comments on commit 14d3f33

Please sign in to comment.