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:
“[email protected]”, 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: trueend
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
http://stackoverflow.com/questions/27139007/cant-migrate-database-after-scaffold-section-2-2-ruby-on-rails-tutorial-michae).
Has anyone seen anything like this before?