Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

model-level-config not working through ActiveRecord_Relation #70

Open
jfanals opened this issue Nov 27, 2019 · 0 comments
Open

model-level-config not working through ActiveRecord_Relation #70

jfanals opened this issue Nov 27, 2019 · 0 comments

Comments

@jfanals
Copy link

jfanals commented Nov 27, 2019

I have been trying with the new hashid_config, as I have just renamed a table that I has using with hashid-rails setting the pepper on the model. I love the functionality. Unfortunately it does not work when querying an ActiveRecord_Relation.

The hashid_config parameters are set using the model parameters correctly as long as the model is queried directly, eg:

Post.hashid_configuration
=> returns correct pepper that is set in the model

But when if the ActiveRecord_Relation is in between it does not work, eg:

Post.all.hashid_configuration
=> returns the original table_name as pepper (overriding the one set on the model)

The hashid_config gets called on the ActiveRecord_Relation, and the options are empty.

This means that this works

Post.find("hashid")

but this doesn't

Post.includes(:comments).find("hashid")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant