Hey,
I have a model called 'MediaSeries'.
I have another model called 'AudioRecording'.
Audio recordings can belong to 1 media series.
class AudioRecording
..
has 1, :media_series, :through => Resource, :model =>
'MediaSeries', :child_key => [:media_series_id], :constraint => :skip
end
class MediaSeries
..
has n, :audio_recordings, :through => Resource, :constraint => :skip
end
This fails with:
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.name
NoMethodError (You have a nil object when you didn't expect it!
The error occurred while evaluating nil.name):
/ruby/lib/ruby/gems/1.8/gems/dm-core-0.10.0/lib/dm-core/
property_set.rb:169:in `initialize'
/ruby/lib/ruby/gems/1.8/gems/dm-core-0.10.0/lib/dm-core/
property_set.rb:169:in `map'
/ruby/lib/ruby/gems/1.8/gems/dm-core-0.10.0/lib/dm-core/
property_set.rb:169:in `initialize'
/ruby/lib/ruby/gems/1.8/gems/dm-core-0.10.0/lib/dm-core/associations/
many_to_many.rb:23:in `new'
......
/ruby/lib/ruby/gems/1.8/gems/dm-core-0.10.0/lib/dm-core/model.rb:
388:in `new'
This appears to be the offending line:
@audio_recording = AudioRecording.new
When I comment out the association everything works fine.
If I remove :child_key, I get this:
ERROR: column audio_recording_media_serieses.media_sery_id does not
exist
LINE 1: ...ording_media_serieses" ON "media_serieses"."id" =
"audio_rec...
^
What am I doing wrong and how can I make this work?
Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DataMapper" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---