-
Notifications
You must be signed in to change notification settings - Fork 79
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
[Rails 7.2] Association named 'audits' was not found on Model; perhaps you misspelled it? #174
Comments
There's a possibility the issue is connected with that one collectiveidea/audited#725 however not sure yet |
Very likely. More directly, the problem is rails/rails#52715. Rails 7.2 interferes with the ability to inherit non-STI from a base class, unless that base class has a table defined. The author of the patch that introduced this bug (see above) decided it was not-a-bug quoting AR's STI docs about setting
Now, Now, this is messy, it's first thing in the morning local time before I've had coffee, but I think this is the situation...
The Rails maintainers examining the issue have refused to fix it. I disagree with that choice. Given their behaviour on the issue and the way they weighed in on the Audited issue too, I have no intention of pursing it further, but if others feel that it's a bug, I encourage you to submit a bug report to the Rails team following their required template. In the mean time, gem author, if your https://github.com/motor-admin/motor-admin-rails/blob/master/app/models/motor/audit.rb#L5 For example, we have: class AuditTrail < ::Audited::Audit
self.table_name = 'audit_trails'
self.superclass.abstract_class = true
...
end |
@pond Thank you very much for your guidance I have a good and a bad news. The good one is I managed to fix the issue locally and I'm going to send a PR this week. |
System configuration
ruby 3.3.4 (2024-07-09 revision be1089c8ec) [x86_64-linux]
Rails 7.2.1
motor-admin 0.4.28
Description
When trying to create a new record an error appears:
Stack trace
I include the stacktrace in a file motor-admin.log
Steps to reproduce
rails new testing_motor
cd testing_motor
bin/setup
bundle install
rails motor:install && rake db:migrate
rails g model Post title:string body:text
rails db:migrate
rails s
http://localhost:3000/motor_admin/data/posts
The text was updated successfully, but these errors were encountered: