uninitialized constant ActiveStorage::AttachmentDashboard
I added a couple of attachments to a new model called program
I added it to administrate:dashboard Program
When I go to that item in dashboard I get this error
I added it to administrate:dashboard Program
When I go to that item in dashboard I get this error
Rendered layout layouts/admin/application.html.erb (Duration: 31.4ms | Allocations: 21254) Completed 500 Internal Server Error in 33ms (ActiveRecord: 1.4ms | Allocations: 22043) ActionView::Template::Error (uninitialized constant ActiveStorage::AttachmentDashboard Object.const_get(camel_cased_word) ^^^^^^^^^^): 17: 18: <% if field.linkable? %> 19: <%= link_to( 20: field.display_associated_resource, 21: [namespace, field.data], 22: ) %> 23: <% end %> app/controllers/administrate/application_controller.rb:16:in `index' app/controllers/admin/application_controller.rb:39:in `block in without_tenant' app/controllers/admin/application_controller.rb:38:in `without_tenant' lib/jumpstart/lib/jumpstart/account_middleware.rb:30:in `call' Started GET "/__rack/swfobject.js" for ::1 at 2022-02-23 13:27:27 -0500 Started GET "/__rack/web_socket.js" for ::1 at 2022-02-23 13:27:27 -0500 Started GET "/__rack/livereload.min.js?host=localhost" for ::1 at 2022-02-23 13:27:27 -0500
Yo! I had this issue with a fresh JSP app yesterday as well. Could you post the code of your dashboard for context? I'll be able to help easier when I can point at specific lines.
But FWIW I just followed what was setup in the user dashboard for the avatar since that's a working, good example of an active storage field in an Administrate dashboard 👍🏻
But FWIW I just followed what was setup in the user dashboard for the avatar since that's a working, good example of an active storage field in an Administrate dashboard 👍🏻
require "administrate/base_dashboard" class ProgramDashboard < Administrate::BaseDashboard # ATTRIBUTE_TYPES # a hash that describes the type of each of the model's fields. # # Each different type represents an Administrate::Field object, # which determines how the attribute is displayed # on pages throughout the dashboard. ATTRIBUTE_TYPES = { logo_attachment: Field::HasOne, logo_blob: Field::HasOne, instructor_pic_attachment: Field::HasOne, instructor_pic_blob: Field::HasOne, id: Field::Number, name: Field::String, description: Field::Text, enrolling: Field::Boolean, instructor: Field::String, instructor_pic: Field::String, logo: Field::String, created_at: Field::DateTime, updated_at: Field::DateTime, }.freeze # COLLECTION_ATTRIBUTES # an array of attributes that will be displayed on the model's index page. # # By default, it's limited to four items to reduce clutter on index pages. # Feel free to add, remove, or rearrange items. COLLECTION_ATTRIBUTES = %i[ logo_attachment logo_blob instructor_pic_attachment instructor_pic_blob ].freeze # SHOW_PAGE_ATTRIBUTES # an array of attributes that will be displayed on the model's show page. SHOW_PAGE_ATTRIBUTES = %i[ logo_attachment logo_blob instructor_pic_attachment instructor_pic_blob id name description enrolling instructor instructor_pic logo created_at updated_at ].freeze # FORM_ATTRIBUTES # an array of attributes that will be displayed # on the model's form (`new` and `edit`) pages. FORM_ATTRIBUTES = %i[ logo_attachment logo_blob instructor_pic_attachment instructor_pic_blob name description enrolling instructor instructor_pic logo ].freeze # COLLECTION_FILTERS # a hash that defines filters that can be used while searching via the search # field of the dashboard. # # For example to add an option to search for open resources by typing "open:" # in the search field: # # COLLECTION_FILTERS = { # open: ->(resources) { resources.where(open: true) } # }.freeze COLLECTION_FILTERS = {}.freeze # Overwrite this method to customize how programs are displayed # across all pages of the admin dashboard. # # def display_resource(program) # "Program ##{program.id}" # end end
Notifications
You’re not receiving notifications from this thread.