-
Notifications
You must be signed in to change notification settings - Fork 8
Saving Null Values #8
Description
Greetings,
I have the following models, and I am using dm-is-list to sort them:
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
property :code, String, :length => 3..5
property :name, String, :length => 1..100
property :description, Text
property :credits, String, :length => 1..10
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]
endI am unable to select a given course and move it, so I am moving the Course Sections. I can use CourseSection.move(position) without issue. My problem gets more complicated when I try to use move_to_list(sectionID, position).
dm-is-list is setting the position value to NULL (I have verified that position is being sent). I have even tried to use move_to_list(sectionID) with no position, and NULL is still saved to the database. Obviously, subsequent attempts to move the item after that fail.
I attempted to define the position property as not null but that just resulted in an error when it tried to save the null. Position should never be null. This is making the gem unusable for me at this time.