Greetings!

I have two classes, one of which is associated to the other using a 
:through => Resource

class Section
> include DataMapper::Resource
>
> property :id, Serial
> property :name, String, :length => 1..100
> property :credits, String, :length => 1..10
>
> has n, :courses, :through => Resource
>
> is :list, :scope => :program_id 
> end
>
> class Course
> include DataMapper::Resource
>
> property :id, Serial
> property :subj, String, :length => 4, :index => [:subject_code]
> property :code, String, :length => 3..5, :unique => [:catalog_code, 
> :subj], :index => [:subject_code]
> property :name, String, :length => 1..100
> property :description, Text
> property :credits, String, :length => 1..10
>
> belongs_to :catalog
> has n, :sections, :through => Resource 
> end
>
> class CourseSection
> include DataMapper::Resource
>
> belongs_to :course, :key => true
> belongs_to :section, :key => true
>
> is :list, :scope => [:section_id]
> end


Sections can have many courses, and courses can be associated with many 
different sections. My issue is that I need to be able to define a position 
for courses for each section, so I can't use the is :list declaration on 
the course itself. However, if I try to use .move on a course I receive the 
following error:

undefined method `move' for #<Course:0x007faac07eb450>


If I instead try to move the association record, I receive the following 
error:

undefined method `move' for [#<CourseSection @position=1 @section_id=6 
@course_id=1>]:DataMapper::Associations::OneToMany::Collection


How do I sort items linked together in this way?

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/datamapper?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to