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

ActiveRecord::UnknownAttributeReference (Query method called with non-attribute argument(s)) #645

Closed
marksiemers opened this issue Jun 2, 2022 · 2 comments
Labels

Comments

@marksiemers
Copy link

I have a task working when running rspec tests, but when testing locally I get the error in the title, more stacktrace below:

[ActiveJob] [MaintenanceTasks::TaskJob] [305b1d88-2ba5-4abb-a602-3bc742d7592d] Error performing MaintenanceTasks::TaskJob (Job ID: 305b1d88-2ba5-4abb-a602-3bc742d7592d) from Async(default) in 37.76ms: ActiveRecord::UnknownAttributeReference (Query method called with non-attribute argument(s): "<my_local_db>.<my_table_name>.id"):
3.1.0/gems/activerecord-6.1.6/lib/active_record/sanitization.rb:145:in `disallow_raw_sql!'
3.1.0/gems/activerecord-6.1.6/lib/active_record/relation/query_methods.rb:1392:in `preprocess_order_args'
3.1.0/gems/activerecord-6.1.6/lib/active_record/relation/query_methods.rb:383:in `reorder!'
3.1.0/gems/activerecord-6.1.6/lib/active_record/relation/query_methods.rb:378:in `reorder'
3.1.0/gems/activerecord-6.1.6/lib/active_record/associations/collection_proxy.rb:1109:in `reorder'
3.1.0/gems/job-iteration-1.3.6/lib/job-iteration/active_record_batch_enumerator.rb:32:in `initialize'
3.1.0/gems/job-iteration-1.3.6/lib/job-iteration/enumerator_builder.rb:125:in `new'
3.1.0/gems/job-iteration-1.3.6/lib/job-iteration/enumerator_builder.rb:125:in `build_active_record_enumerator_on_batch_relations'
3.1.0/gems/maintenance_tasks-1.10.1/app/jobs/concerns/maintenance_tasks/task_job_concern.rb:53:in `build_enumerator'
3.1.0/gems/job-iteration-1.3.6/lib/job-iteration/iteration.rb:114:in `block in interruptible_perform'

Is there a good workaround for this? Is this a known issue in working with rails 6.1.6?

@marksiemers
Copy link
Author

I may have tracked this down in the job-iteration gem, opened a PR: Shopify/job-iteration#226

Copy link

This issue has been marked as stale because it has not been commented on in two months.
Please reply in order to keep the issue open. Otherwise, it will close in 14 days.
Thank you for contributing!

@github-actions github-actions bot added the stale label Jan 26, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant