Comments (4)
I'm having the same issue. I've tested several scenarios, seems this issue will happen only when using :only with devise gem.
from audited.
More information after a bit of research: It's caused by the
devise_for :users
that devise added to the routes.rb
.
rake tasks will load rails environment first which in turn load the all the route definitions from routes.rb, and because of devise_for :users
, devise will call it's add_mapping
method and eventually use your User model definition. This triggered the acts_as_audited
call, and in that call, if you have :only option set, it'll check model's table column_names, but at this time the table doesn't exists yet, thus here comes the issue.
So one work around would be comment out the devise_for :users
in your routes file before you do db migration from scratch and then uncomment it. This is ugly but still have no idea how to fix it.
from audited.
This is a really old issue, which unfortunately is still unresolved as of 4.2. Rather than commenting code out, I solved the issue this way:
class User < ActiveRecord::Base
audited if self.table_exists?
...
end
If/when I have more time, I'll look into adding a check and submitting a pull request.
from audited.
@fdeschenes Thank you for the workaround. Yes, please submit a PR (if you haven't already). Thank you!
from audited.
Related Issues (20)
- Using audited in Rails 7.0.7 generates a lot of deprecation warnings HOT 3
- created_at value has the timezone offset applied twice (>= 5.0.0)
- Readonly attributes are registered as modified HOT 1
- Rails 7.1.beta.1 - DEPRECATION WARNING: Module.deprecate without a deprecator is deprecated HOT 1
- Exclude Audited Gem Log Entries from PostgreSQL Database Storage
- Encryption for audited_changes / disabling the FILTERED feature HOT 3
- Audits with line of code location HOT 1
- Different kinds of User. HOT 2
- Updating an enum field on audited record while updating nested resource with touch: true creates a double audit
- `#touch` on record results in `NoMethodError` HOT 1
- Conditionally turn off audits in tests
- Auditing models with a Composite Primary Key - possible? HOT 1
- Ignoring deleted_at/deleted_on attributes
- Support for batch creation of audits HOT 2
- Support for BigInt HOT 1
- How to ignore impersonated user ?
- Specify action
- Add YAML safe load documentation
- Gem is not saving auditable_id, auditable_type for User model
- When combining old audits, oldest value should be kept
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from audited.