Ruby on Rails
Sunday, December 28, 2014
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 received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/0fb8a85c-d3f4-4312-aec8-7887c0136088%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment