Rails Arel unit test error

I have the following error:

ERROR["test_character_should_be_valid", CharacterTest, 0.214787]
test_character_should_be_valid#CharacterTest (0.21s)
NoMethodError:         NoMethodError: undefined method `val' for "$1":Arel::Nodes::BindParam
app/models/user.rb:11:in `block in <class:User>'
test/models/character_test.rb:8:in `setup'

From the following test: test/models/character_test.rb:

    require 'test_helper'

    class CharacterTest < ActiveSupport::TestCase

      def setup
@user = User.new(name: "Example User", email: "user@example.com", callsign: "example",
                         password: "foobar", password_confirmation: "foobar")
        @user.        save
@character = @user.      character
end

      test "character should be valid" do
        assert @character.valid?
      end

    end # CharacterTest

In the gemfile:

gem 'arel', '6.0.0.beta2'

character.rb:

class Character < ActiveRecord::Base
  belongs_to :sociable, polymorphic: true
end

user.rb:

class User < ActiveRecord::Base

  has_one :character, as: :
  sociable
before_validation do
    self.create_character unless character
end
  .
  .
end

I can’t find anything about this particular arel error. My arel gem is 6.0.0.beta2, which seems to fix other problems (as in here). Has anyone seen anything like this before?

You have not told us which is line 11 in user.rb, which is the line it
says the error is on.

Colin

Sorry, line 11 is:

self.create_character unless character # line 11

Problem solved: it's because the columns sociable_id and sociable_type
weren't defined in the schema.