trestle icon indicating copy to clipboard operation
trestle copied to clipboard

undefined method `all' for Directory:Module

Open JalenOng opened this issue 6 years ago • 1 comments

Hi,

I followed the installation guidelines and went to http://localhost:3000/admin but I got this error:

undefined method `human_attribute_name' for Company:Class

Please advise. Thanks

JalenOng avatar Jan 25 '19 04:01 JalenOng

First of all, sorry for the slow response to your question.

undefined method `human_attribute_name' for Company:Class

This seems to indicate that the Company class is not a subclass of ActiveRecord::Base. If you are using an alternative ORM, you may need to customize the adapter, or override the adapter methods on a per-admin basis.

Trestle.resource(:companies) do
  adapter do
    def human_attribute_name(attribute)
      attribute.to_s.titleize
    end
  end
end

undefined method `all' for Directory:Module

This indicates that the model for your admin resource isn't being inferred correctly. You might need to specify it explicitly as an option:

Trestle.resource(:directories, model: MyDirectoryClass)
end

spohlenz avatar Feb 27 '19 02:02 spohlenz