Skip to content

undefined method `to_model' for nil:NilClass #307

@millenniumiguana

Description

@millenniumiguana

Hi!

We are using the enumerize gem along with the activeadmin gem, which makes use of formtastic. A number of our forms do not provide an object, like so:

panel 'Do something awesome' do
  active_admin_form_for(
    '',
    method: :post,
    url: awesome_admin_user_path(user)
  ) do |f|
    f.inputs do
      f.input :awesome_id, as: :select
      f.input :other_awesome_thing
    end
    f.submit 'Submit me!'
  end
end

With an update of enumerize from 2.1.2 to 2.2.0, we now get the error in the title when we render these views. I've tracked it down to a change in lib/enumerize/hooks/formtastic.rb on line 8.

I have downgraded our version to 2.1.2 for the time being, but would appreciate your recommendation on whether this is a bug, or we are using forms in an unusual manner that isn't compatible with the changes in enumerize.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions