Comments (12)
If you're using the license_finder
gem and it's in your Gemfile
make sure to set :require => false
option or else Sequel will be introduced into your Rails project alongside ActiveRecord.
from arel.
I'm not sure this is an Arel bug, since the buggy code is in ActiveRecord. The issue was introduced in rails/rails@a1c05dd. Looking at that commit, there's definitely a reason for the change, so you aren't going to want to just revert it. Hopefully the respond_to?(:as) check can be switched to something better. @ernie, do you have any ideas?
from arel.
Yeah, there's definitely a reason for the change. @jeremyevans, is it safe for me to assume that since Sequel users who are also using AR are being bitten by this bug, that Sequel monkeypatches String with an implementation of #as?
I'm really loathe to go back to checking for included modules or such, though if we really, really needed to, some refactoring at the ARel level would let us check for inclusion of Arel::AliasPredication. Did I mention I'm not really OK with doing that, though?
from arel.
Answering my own question: yeah -- https://github.com/jeremyevans/sequel/blob/master/lib/sequel/extensions/core_extensions.rb#L173
Looks like that's the culprit. :(
from arel.
Correct. Sequel can be used without any core extensions by requiring sequel/no_core_ext (a feature I don't believe ActiveRecord offers), but that's not going to be the default till Sequel 4.
FWIW, Sequel has defined String#as and Symbol#as for over 4 years, and this is the first case I'm aware of of something breaking because of it.
from arel.
Is it common to use both Sequel and AR in the same project? I always sort of imagined Sequel was more of an alternative to AR vs something you'd only use piecemeal.
from arel.
One thing to note, as a workaround, is that it's possible to teach ARel how to visit the Sequel::SQL::AliasedExpression, since it looks like your implementation of #as
otherwise conforms to the same API as ARel's.
from arel.
If discussion is to continue on this, it probably makes sense to move it to the Rails issue tracker, with a reference to this issue. It's not an issue with ARel, really.
from arel.
@ernie a quick search of rails issues didn't turn up any tickets related to this .. you know if there's any fix?
from arel.
@joevandyk I wouldn't say this would be optimal but the only fix that comes to mind, if you must have Sequel's monkeypatches on String, it would be possible to check the as method's owner.
from arel.
BTW, for people who are coming across this bug, instead of
require 'sequel'
use
require 'sequel/no_core_ext'
And make sure that you don't have require 'sequel'
anywhere.
This will remove sequel's monkeypatches on a couple core objects -- and you probably don't need those anyways. This will be the default behavior for sequel 4.0.
from arel.
+1, thanks @veloper -- that was the cause for me as well.
from arel.
Related Issues (20)
- Support of batched UPSERT and UPDATE queries HOT 2
- Migration from 6 to 7 HOT 1
- UncaughtThrowError: uncaught throw {:__recursive_key__=>true, 19667120=>true} from visitors/reduce.rb:13 HOT 4
- Arel::Nodes::Division does not divide first argument by second argument HOT 2
- Arel node for an array element (suffix operator) HOT 2
- wrong type for results of average HOT 2
- Delegate #to_s to #to_sql HOT 1
- multiple arel conditions raise SystemStackError: stack level too deep HOT 1
- Limit expression generated with bind param but no value (works with 6.0.4/breaks with 7.1.4) HOT 4
- activerecord (5.1.4) lib/active_record/relation/predicate_builder.rb:113:in `new' not passing a value, causing Arel 9.0.0 to fail HOT 1
- SqlLiteral does not serialize/de-serailize correctly HOT 1
- `NameError: uninitialized constant FakeRecord::Connection::DateTime` with Ruby 2.5.0 HOT 2
- Atomic upsert? HOT 2
- Registering Visitors HOT 1
- Expression in `in` is broken in 7.1.4 and 8.0.0 HOT 6
- union operation broken in 9.0.0 HOT 1
- Why is `Arel::Nodes::Or.neq` different from `Arel::Nodes::And.new`? HOT 2
- Timestamp between columns, how can i do it? HOT 1
- NamedFunction as HOT 2
- Documentation HOT 1
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 arel.