baby_squeel: Breaks with Rails 6.0.0

Issue

Trying to prepare to Rails 6.0.0 and seems like babe_squeel (even with patch for Rails 5.2.1+) doesn’t work

ArgumentError: wrong number of arguments (given 3, expected 2)

Reproduction

require 'bundler/inline'
require 'minitest/spec'
require 'minitest/autorun'

gemfile true do
  source 'https://rubygems.org'
  gem 'rails', '>= 6.0'
  gem 'sqlite3'
  gem 'baby_squeel'
  gem 'polyamorous', '~> 1.3.4', git: 'https://github.com/vintrepid/polyamorous'
end

ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')

ActiveRecord::Schema.define do
  create_table :humans, force: true do |t|
    t.string :name
  end
  create_table :dogs, force: true do |t|
    t.string :name
    t.references :user
  end
end

class Human < ActiveRecord::Base
end

class Dog < ActiveRecord::Base
belongs_to :human
end

class BabySqueelTest < Minitest::Spec
  it 'breaks' do
    Dog.joins(:human).to_sql
  end
end

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 28 (9 by maintainers)

Most upvoted comments

@rzane This should be solved.

Hey @marnen (and everyone else), I want to open up more discussion, and a closed issue probably isn’t the right place for that 😂 . I’ve created two discussions:

  • This discussion can be used to talk through Active Record 6 support. If you start working on that and need any guidance, maybe I can answer questions there.
  • This discussion is a place where we can talk about what a different, more maintainable library might look like.

Yes if I remove the polyamorous from the test in the issue and set the rails version to gem 'rails', '= 6.0' it’s green.

If you find any other bugs please provide an example.

@rzane I know you’re contemplating the viability of continuing working on this. That considered, I just stumbled upon https://github.com/camertron/arel-helpers/blob/master/lib/arel-helpers/join_association.rb that seems to be kept up to date pretty well.

Wouldn’t using ArelHelpers to back baby_squeel be a good compromise?

@rzane could you write tests that would support Rails 6 compatibility? I am happy to take a crack at an implementation. Maybe we can convince someone on the Rails/AR/Arel team to review?

@tenderlove, could Rails possibly take over ownership of this project? Perhaps with an eye to integrating it into a future release or opening up Arel? Would really love a solution to get through Rails 6 at least.

@kbighorse, I haven’t had the time to maintain this project. I’m willing to accept PRs, but @vitalinfo’s PR doesn’t pass the tests.