Skip to content
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

Add support for Active Record 5.2 #87

Merged
merged 8 commits into from
Apr 25, 2018
Merged

Add support for Active Record 5.2 #87

merged 8 commits into from
Apr 25, 2018

Conversation

rzane
Copy link
Owner

@rzane rzane commented Mar 9, 2018

🎉 This has been much easier than I had expected!

There are only two remaining issues:

  • Polymorphic associations
  • BabySqueel::Association#! spec is broken

Fixes #85.

@rzane rzane mentioned this pull request Mar 9, 2018
@coveralls
Copy link

coveralls commented Mar 9, 2018

Coverage Status

Coverage increased (+0.005%) to 98.981% when pulling 34e07ba on 52-support into b165a50 on master.

@rzane
Copy link
Owner Author

rzane commented Mar 30, 2018

Okay, seems like this all comes down to activerecord-hackery/polyamorous#37.

@rainerborene
Copy link

rainerborene commented Apr 13, 2018

@rzane master branch is already usable? i can't use it yet.

gem "join_dependency", github: "rzane/join_dependency"
gem "baby_squeel", github: "rzane/baby_squeel"
ArgumentError: wrong number of arguments (given 3, expected 2)
  /home/rainer/.asdf/installs/ruby/2.4.3/lib/ruby/gems/2.4.0/bundler/gems/baby_squeel-924cfe4b0373/lib/baby_squeel/active_record/query_methods.rb:43:in `build_joins'
  /home/rainer/.asdf/installs/ruby/2.4.3/lib/ruby/gems/2.4.0/gems/activerecord-5.2.0/lib/active_record/relation/query_methods.rb:928:in `build_arel'
  /home/rainer/.asdf/installs/ruby/2.4.3/lib/ruby/gems/2.4.0/gems/activerecord-5.2.0/lib/active_record/relation/query_methods.rb:903:in `arel'
  /home/rainer/.asdf/installs/ruby/2.4.3/lib/ruby/gems/2.4.0/gems/activerecord-5.2.0/lib/active_record/relation.rb:554:in `block in exec_queries'
  /home/rainer/.asdf/installs/ruby/2.4.3/lib/ruby/gems/2.4.0/gems/activerecord-5.2.0/lib/active_record/relation.rb:578:in `skip_query_cache_if_necessary'
  /home/rainer/.asdf/installs/ruby/2.4.3/lib/ruby/gems/2.4.0/gems/activerecord-5.2.0/lib/active_record/relation.rb:542:in `exec_queries'
  /home/rainer/.asdf/installs/ruby/2.4.3/lib/ruby/gems/2.4.0/gems/activerecord-5.2.0/lib/active_record/relation.rb:414:in `load'
  /home/rainer/.asdf/installs/ruby/2.4.3/lib/ruby/gems/2.4.0/gems/activerecord-5.2.0/lib/active_record/relation.rb:200:in `records'
  /home/rainer/.asdf/installs/ruby/2.4.3/lib/ruby/gems/2.4.0/gems/activerecord-5.2.0/lib/active_record/relation/finder_methods.rb:502:in `find_take'
  /home/rainer/.asdf/installs/ruby/2.4.3/lib/ruby/gems/2.4.0/gems/activerecord-5.2.0/lib/active_record/relation/finder_methods.rb:103:in `take'
  /home/rainer/Projects/rails/app/models/user/custom_devise.rb:33:in `find_for_authentication'

@rzane
Copy link
Owner Author

rzane commented Apr 13, 2018

@rainerborene, I think you forgot to specify the branch. It should be:

gem "join_dependency", github: "rzane/join_dependency"
gem "baby_squeel", github: "rzane/baby_squeel", branch: "52-support"

However, this PR hasn't been merged yet for a good reason. Polymorphic associations are broken upstream (in the polyamorous gem), as documented in this issue: activerecord-hackery/polyamorous#37. So, if you query a polymorphic association, the wrong record might be returned.

@Schwad
Copy link

Schwad commented Apr 25, 2018

Okay, I am also pointing to this branch. @rzane, feel free to @ message me when it's ready, or if there's anything else I can do to help!!!

@Schwad
Copy link

Schwad commented Apr 25, 2018

Also @rzane just going to say that I tried to point to your branch but it broke because of the sqlite3 dependency on join_dependency.... This may be very dangerous but I am forking it to see how things run without that dependency.... 🙊

@rzane
Copy link
Owner Author

rzane commented Apr 25, 2018

Oh whoops, that was an accident. Sqlite is definitely not a real dependency. I'll fix that today.

@rzane
Copy link
Owner Author

rzane commented Apr 25, 2018

Okay, I'm going to merge this. The remaining issue (re: polymorphic associations) is not a Baby Squeel issue, and therefore, it doesn't make sense not to release this.

For reference, this is the bug: activerecord-hackery/polyamorous#37.

@Schwad, that sqlite dependency issue should be resolve now as well.

To anyone who uses Baby Squeel or Ransack and uses polymorphic associations, I wouldn't recommend upgrading to 5.2 until that issue is resolved.

@rzane rzane merged commit f6d11f5 into master Apr 25, 2018
@rzane rzane deleted the 52-support branch April 25, 2018 18:30
@rzane
Copy link
Owner Author

rzane commented Apr 25, 2018

Released: https://rubygems.org/gems/baby_squeel/versions/1.2.1

@Schwad
Copy link

Schwad commented Apr 25, 2018

@rzane Awesome!!! Thank you so much!!!

@ConnerMan
Copy link

Much appreciated @rzane! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants