-
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
, yet rails don't create the active storage class in the model folder. I've done research about how to fix that but I didn't find a proper way.
but rails don't create the active storage class. |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 4 replies
-
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.
-
Which code snippet are you referring to?
If you mean the "has_many" relationships... They go into your model.
…On Thu, Nov 28, 2024, 11:08 PM LRosdobutko ***@***.***> wrote:
Do you mind if I ask what file you are supposed to insert that code
snippet into? I'm fairly new to rails and basically teaching myself when I
can, where I can, and some hand holding is greatly appreciated. lol
—
Reply to this email directly, view it on GitHub
<#8077 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA2KI55ECZ2QP2MRCONWHM32C6H5RAVCNFSM6AAAAAA7NW2UOGVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCNBRGA2DQMQ>
.
You are receiving this because you commented.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
Here's what worked for me: Create a module in an initializer that extends
|
Beta Was this translation helpful? Give feedback.
-
It's not REALLY a "solution"... It's more of a workaround. In my opinion
this issue shouldn't have been closed until the issue was actually fixed. I
mean it's been YEARS now...
…On Sat, May 17, 2025, 3:34 AM Mason Chang ***@***.***> wrote:
Confirmed this solution works, thank you so much!!
—
Reply to this email directly, view it on GitHub
<#8077 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA2KI55ZUVIVZK4MVECLVTD262G37AVCNFSM6AAAAAB4MHBKKWVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTGMJXGY2DSNI>
.
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