rism-digital / muscat

🗂️ A Rails application for the inventory of handwritten and printed music scores
http://muscat-project.org
34 stars 16 forks source link

Muscat crashes on opening the workgroup index page #1665

Closed HirschSt closed 2 weeks ago

HirschSt commented 2 weeks ago

Muscat crashes on opening the workgroup index, as you may have seen:

[ERROR] workgroups#index (ActionView::Template::Error) "Ransack needs Workgroup attributes explicitly allowlisted ..."

Ransack needs Workgroup attributes explicitly allowlisted as
searchable. Define a `ransackable_attributes` class method in your `Workgroup`
model, watching out for items you DON'T want searchable (for
example, `encrypted_password`, `password_reset_token`, `owner` or
other sensitive information). You can use the following as a base:

```ruby
class Workgroup < ApplicationRecord

  # ...

  def self.ransackable_attributes(auth_object = nil)
    ["created_at", "description", "email", "id", "id_value", "libpatterns", "name", "updated_at"]
  end

  # ...

end

app/admin/workgroup.rb:37:in `index'

fjorba commented 2 weeks ago

Same here. I haven't investigated yet, because we still don't use it.

HirschSt commented 2 weeks ago

Can be fixed by adding

 def self.ransackable_associations(_) = reflections.keys
 def self.ransackable_attributes(_) = attribute_names - %w[token]

as with other non marc models.