I have an (I think) relatively straightforward has_many :through
relationship with a join table:
class User < ActiveRecord::Base
has_many :user
My guess is that you need to reload your Thing
instance by doing @thing.reload
(I'm sure there's a way to avoid this, but that might get your test passing at first and then you can figure out where you've gone wrong).
Few questions:
I don't see you calling @thing.save
in your spec. Are you doing that, just like in your console example?
Why are you calling t.save
and not u.save
in your console test, considering you're pushing t
onto u
? Saving u
should trigger a save to t
, getting the end result you want, and I think it would "make more sense" considering you are really working on u
, not t
.