Ruby on Rails Tuesday, September 2, 2014

Hello,

I'm having an error I don't understand for several days. I have a class
Game, which have 2 attributes :
class Game < ActiveRecord::Base
has_many :players
has_many :cards, as: :cardable


Then I create a new instance and access the players it fails with void
value expression.

@game = Game.new(game_params);
puts "cards"
puts @game.cards
puts @game.cards.size()
puts "players"
puts @game.players

It displays:
cards
0
players

And it fails with: "void value expression" on the last line.

A few days ago this code worked just fine, I don't know what changed and
how to understand how to fix it.

Thank you.

--
Posted via http://www.ruby-forum.com/.

--
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/f17aacbad6ed08d697bac0440966afb8%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment