This could just be my lack of knowledge of how Rails works but from the
following code in my RSpec test …
$stderr.puts “BEFORE:
#{@invitation.meeting.event.event_type.event_type_time_units.inspect}”
@invitation.save!
EventTypeTimeUnit.all.each {|rec| $stderr.puts rec.inspect }
$stderr.puts “AFTER REC INSPECT
#{@invitation.meeting.event.event_type.inspect}”
$stderr.puts “AFTER LIST INSPECT
#{@invitation.meeting.event.event_type.event_type_time_units.inspect}”
… I get the following output. The thing that is not
right,
is that there is no data for the association event_type_time_units. The
data is in the DB, the ids, foreign keys are correct but I just can’t
get
the data from the association.
BEFORE: [#<EventTypeTimeUnit id: 1, event_type_id: 1, time_unit_id:
1,…>,
#<EventTypeTimeUnit id: 2, event_type_id: 1, time_unit_id: 2, …>,
#<EventTypeTimeUnit id: 3, event_type_id: 1, time_unit_id: 3, …>]
#<EventTypeTimeUnit id: 1, event_type_id: 1, time_unit_id: 1, …>
#<EventTypeTimeUnit id: 2, event_type_id: 1, time_unit_id: 2, …>
#<EventTypeTimeUnit id: 3, event_type_id: 1, time_unit_id: 3, …>
AFTER REC INSPECT #<EventType id: 1, event_category_id: 1, …>
AFTER LIST INSPECT []
Can someone please put me out of my ignorant misery, please.
Thank you.
-ants