alias_method_chain is deprecated in Rails 5
arokettu opened this issue · 1 comments
arokettu commented
Probably change is needed at lib/enum_help/simple_form.rb:73
from class_eval to creating a module and prepending it
gregblass commented
Until this depreciation warning is fixed (and maybe forever), I rolled my own like so:
In ApplicationHelper:
def enum_collection_for_select(attribute, include_blank = true)
x = attribute.map { |r| [r[0].titleize, r[0]] }
x.insert(0,['', '']) if include_blank == true
x
end
Then with simpleform (could be used without simpleform too):
<%= f.input :role, collection: enum_collection_for_select(User.roles), selected: @user.role %>
Probably not the best idea rely on these little gems that are not updated to fix simple depreciation warnings well after the Rails 5 release.