Fix for ActiveRecord 4.2 and Arel changes #354
Conversation
Change for API update on ActiveRecord 4.2 (commit 08579e4078454c6058f1289b58bf5bfa26661376)
|
Note that this fix breaks ActiveRecord 4.1 compatibiltiy. (I upgraded to rails 4.2, needed this fix, then downgraded again because of some other problems), had to revert this version back to stock squeel 1.2.2 |
Checks the size of the changed method to determine which arguments to provide.
@nathansamson I added a fix for this. Let me know if it works for you (although it seems like you took the right steps to resolve your problem). |
Their are extra test cases failing on Travis CI for Rails 4.1 & PostgreSQL adapter (exactly my use case), so it still feels you introduced a problem... |
Perhaps it would be better if #d665b08 would be be better applied to active_record/4.2/relation_extensions.rb rather than conditionally in 4.1? |
@yule I wondered the same thing. I'm not very familiar with the code base so I'm not exactly sure why active_record/4.1/relation_extensions.rb was being used instead of active_record/4.2/relation_extensions.rb on Rails 4.2. Perhaps somebody else could enlighten me? @nathansamson I'll look into that. |
@danielrhodes Thanks for the fix, could you please create a new branch (not master) and push it again? So I could fix some minor spec errors after merging your branch. |
Any update on when a new version of Squeel will be released with this fix? |
Yes, a release would be great. |
e7f0168
into
activerecord-hackery:master
Thank @danielrhodes . The new squeel 1.2.3 has been released. Please enjoy it :) |
Thank you! |
Thanks guys ;) |
The ActiveRecord fix is pretty straightforward.
In the new Arel version (commit where it breaks is mentioned), the
BindParam
class now subclassesNode
instead ofSqlLiteral
which means that none of the String methods will work. It's unclear if the needed reordering for Postgres (mentioned in the comment) is now handled by Arel, or if that replacement needs to occur elsewhere.