Comments (4)
It seems that the problem is in mobility/lib/mobility/active_record/uniqueness_validator.rb
line 14
.
if relation.exists?
error_options = options.except(:case_sensitive, :scope, :conditions)
error_options[:value] = value
record.errors.add(attribute, :taken, error_options)
end
Using relation.exists?
or relation.any?
I get the same error. If i use relation.present?
, it works as expected.
from mobility.
Ok I found the root cause.
For the record, it's this line, which checks if the relation responds to a method (mobility_where_chain
). Calling respond_to?
, which should be fine, actually memoizes an arel object here in AR. This in turn is picked up by assert_mutability!
here, which is what's raising the error.
I can fix this by replacing relation.respond_to?
by relation.methods.include?
, which seems ugly but works. This feels like an AR bug but I don't know the internals of what must have changed, so not quite sure...
Anyway that change should be relatively harmless and fix the issue in Rails 5.1. 😄
from mobility.
This should be fixed now on master, please give it a try.
from mobility.
@shioyama I confirm that this is working without issues now. Thank you for the quick fix.
from mobility.
Related Issues (20)
- Error when installing on Vitess MySQL db HOT 4
- The presence plugin doesn't work as expected HOT 1
- Destruction of record+translations fails, when model IDs are of the type "varchar(36)" (a UUID string) HOT 3
- accessor super method doesn't work with arguments like class.value(locale: :de) HOT 1
- ordering by specific locale HOT 2
- Add type checking plugin reference HOT 3
- eager_load and pluck builds the wrong query HOT 1
- `i18n` scope incompatible with `exists?` HOT 1
- validates presence: true failing with cache active HOT 3
- Empty content row is created in translation table. HOT 1
- No fixtures are generated / No doc on how to make them ourselves HOT 2
- Not working properly with Rails 7.1.1 HOT 1
- Cannot inject the query when using query method block HOT 2
- Allow composite foreign keys HOT 3
- Mobility with active_storage for translatable attachements HOT 1
- 1.3.0.rc1 Can't assign an translated attribute with a column fallback HOT 2
- Fallbacks in runtime HOT 1
- Migration from `globalize`: foreign keys
- table fallbacks
- Testing and fixtures
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 mobility.