mysql - Model.association is returning nil, even with a valid id -
i have 2 models, webcast, , session. webcast belongs session, , session has 1 webcast. also, i'm using sti session, inherits model schedulable, , has type = 'session'.
i have session record, lets phone call session, , webcast record, we'll phone call webcast.
webcast.session_id equal session.id, , vice versa
yet, when query association, webcast.session nil. however, session.webcast returns webcast record.
also, have tried querying webcast.session on past webcast record , loads associated record fine.
any ideas happening here? in advance.
update:
queries:
(session.webcast)
webcast load (1.0ms) select `webcasts`.* `webcasts` `webcasts`.`session_id` = 2679 limit 1
(webcast.session)
session load (0.3ms) select `schedulables`.* `schedulables` `schedulables`.`import_id` null , `schedulables`.`type` in ('session') , `schedulables`.`id` = 2679 order `schedulables`.`starts_at` asc limit 1
also, noticed if load specific session record webcast belongs too, reload webcast record , seek webcast.session 1 time again homecoming session record rather nil.
mysql ruby-on-rails activerecord ruby-on-rails-4 single-table-inheritance
No comments:
Post a Comment