
Dm-is-list saving Null position value to database
Reported by Elanor Riley | June 4th, 2013 @ 07:36 AM
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]
end
I 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, 100), an explicitly set position, and 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 explicitly 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.
The specific error received is:
undefined method `-' for nil:NilClass
file: list.rb location: move_without_saving line: 591
or
undefined method `+' for nil:NilClass
file: list.rb location: move_without_saving line: 545
No comments found
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »