-
I'm using active admin gem for the admin dashboard. I have never faced same the ransackable error since I've used it, I have the user model which has the active storage so I got this error |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 1 reply
-
Similar error here. I have a model, simplified for brevity class Blog::Post < ApplicationRecord
has_one_attached :featured_image
has_many_attached :images
end and when loading the ActiveAdmin views for this model I receive this error:
class Blog::Post < ApplicationRecord
# ...
def self.ransackable_attributes(auth_object = nil)
["body", "created_at", "description", "id", "id_value", "published", "slug", "title", "updated_at", "user_id"]
end
# ...
end When updating the model accordingly, I see a new error:
class Blog::Post < ApplicationRecord
# ...
def self.ransackable_associations(auth_object = nil)
["featured_image_attachment", "featured_image_blob", "images_attachments", "images_blobs", "user"]
end
# ...
end And finally, when updating the model accordingly again, I'm back to (a variation) on the first error:
class ActiveStorage::Attachment < ApplicationRecord
# ...
def self.ransackable_attributes(auth_object = nil)
["blob_id", "created_at", "id", "id_value", "name", "record_id", "record_type"]
end
# ...
end |
Beta Was this translation helpful? Give feedback.
-
I was also having the same issue, i found this works for me, you'll have to remove the activestorage tables from being searchable
|
Beta Was this translation helpful? Give feedback.
-
This should be on the main page somewhere if it isn't already... I would imagine every single ActiveAdmin user (or most of them) must run into this problem eventually. Took me all day to find this discussion. |
Beta Was this translation helpful? Give feedback.
-
Took me couple of hours to realise that this answer points to |
Beta Was this translation helpful? Give feedback.
-
That means you're just as smart as everyone else here... only slower! :)
…On Tue, Feb 27, 2024 at 4:46 PM Abhinay Kumar ***@***.***> wrote:
Took me couple of hours to realise that this answer
<#8077 (comment)>
points to *_attachment and *_blob version of the association on the model.
—
Reply to this email directly, view it on GitHub
<#8077 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA2KI56YTLXPD4YDXBGH4GTYVX5VLAVCNFSM6AAAAAA7NW2UOGVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DMMBXGAYTS>
.
You are receiving this because you commented.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
I was also having the same issue, i found this works for me, you'll have to remove the activestorage tables from being searchable