ruby on rails - Understanding polymorphic associations the right way -


i've tried set polymorphic association in app, when test out, seem able retreive association 1 way:

class event < activerecord::base   has_many :category_associations, :as => :categorized end  class categoryassociation < activerecord::base   belongs_to :categorized, :polymorphic => true end 

now, in console, created categoryassociations (one being @ca ) , event ( @e ). do

@ca.categorized = @e @ca.save 

my problem is, if load event , try @e.category_associations empty array ... when try loading @ca , @ca.categorized, event !!

are polymorphic associations 1 way ? or missing ?

thanks tadman questions, 1 asking me check ruby version, had quit console , restart it. didn't else association both ways !

i'm gonna try reproduce now, problem solved...


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -