On 15 September 2014 22:56, Adrien R. <li...@ruby-forum.com> wrote:
> Colin Law wrote in post #1157676:
>> On 15 September 2014 21:15, Adrien R. <li...@ruby-forum.com> wrote:
>>> Colin Law wrote in post #1157627:
>>>> Sorry, I meant Player of course.
>>>>
>>>
>>> Here it is:
>>>
>>> class Player < ActiveRecord::Base
>>>   belongs_to :game
>>>   has_many :cards, as: :cardable
>>
>> What happens if you say
>> puts @game.players.inspect
>>
>> Colin
>
> The same result as previously since the @game.players is nil, it fails
> with "void value expression".

You would not get the error if it were nil.  nil.inspect is a
perfectly valid statement.

Post the full stack trace of the error along with the relevant bit of
source (the version with puts @game.players.inspect) and give us a
line number.

What versions of ruby and rails are you running?

Also try going back through the versions of code till you find one
that did not show the problem and see what changes you made.
Something must have changed to make it behave differently.  Either in
the code or the running environment (version of ruby and so on).

Colin


>
> The result for @game.inspect gives me this:
> #<Game id: 50, status: nil, created_at: "2014-09-15 21:54:14",
> updated_at: "2014-09-15 21:54:14", big_blind: 2, small_blind: 1,
> player_number: 2, pot: nil, button: nil, to_call: nil, current_player:
> nil>
>
> --
> 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+unsubscr...@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/41a4027130c38e69f34fc102ccfd6e3d%40ruby-forum.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@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/CAL%3D0gLuwzN6SV-U%2BipeXfMR3%2BGwgDA1hfD7MzjoByrzj-hhU9w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to