Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.

Saving Null Values #8

Open
oranges13 opened this issue Jun 4, 2013 · 0 comments
Open

Saving Null Values #8

oranges13 opened this issue Jun 4, 2013 · 0 comments

Comments

@oranges13
Copy link

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) 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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant