administrate icon indicating copy to clipboard operation
administrate copied to clipboard

undefined method `associative?' for nil:NilClass

Open dmc2015 opened this issue 4 years ago • 1 comments

  • What were you trying to do? Render show page in administrate dashboard

  • What did you end up with (logs, or, even better, example apps are great!)?

Showing /app_path/app/views/fields/has_many/_show.html.erb where line #21 raised:
undefined method `associative?' for nil:NilClass

image

I've check the associations between the model, dashboards and associated models and it looks right to me.

In the rails debugger the field looks like:

=> #<Administrate::Field::HasMany:0x00007fc3991eadc0 @attribute=:coates, @data=#<ActiveRecord::Associations::CollectionProxy [#<Coat id: 229, title: "brown jacket", description: ".".....
>>  

I am guessing there is an issue between coat and my dashboard model but it looks ok to me.

The error isn't very helpful.

  • What versions are you running?
    • Rails
      • rails (>= 5.2.1)
    • administrate
      • administrate (0.14.0)

dmc2015 avatar Oct 06 '21 13:10 dmc2015

I noticed this: @attribute=:coates in the text you paste. Could it be that there is a typo in your SHOW_PAGE_ATTRIBUTES, and you are listing coats as "coates"?

If this is not the problem, we are going to need a bit more. Could you please provide the following?

  • Full exception trace.
  • Models.
  • Dashboards.

pablobm avatar Nov 05 '21 07:11 pablobm

Closing due to lack of activity.

pablobm avatar Apr 06 '23 21:04 pablobm