Thanks and Cheers!

On Jan 21, 1:32 pm, Martin Gamsjaeger <gamsnj...@gmail.com> wrote:
> Hey,
>
> I just pushed a fix for this to dm-is-tree. Thx for finding this and sharing!
>
> http://github.com/datamapper/dm-more/commit/db424c34cc20349c640e2f3d9...
>
> cheers
> snusnu
>
> On Thu, Jan 21, 2010 at 12:57, sliu <liusong1...@gmail.com> wrote:
> > Because I didn't declare :parent_id property(is :tree genereates it
> > implicitily), so
>
> >http://github.com/drove/dm-more/blob/master/dm-is-tree/lib/dm-is-tree...
>
> > Line 95:
> > options = { tree_options[:child_key] => nil }
>
> > should be changed to:
>
> > options = { :parent => nil }
>
> > On Jan 21, 11:48 am, sliu <liusong1...@gmail.com> wrote:
> >> My previous post can resolve the "NOT NULL restriction issue" using an
> >> explict :required => false option, but bring another issue.
> >> Since :required option is only accepted by belongs_to, not has n.
> >> So the two line I mentioned above should be modified 
> >> as:http://github.com/drove/dm-more/blob/master/dm-is-tree/lib/dm-is-tree...
> >> (L74-L75)
>
> >>         assc_options = { :model => options[:model], :child_key => Array
> >> (options[:child_key])}
> >>         has_n_options = options[:order] ? { :order => Array(options
> >> [:order]) }.merge(assc_options) : assc_options.dup
> >>         assc_options.update(:required => false)
>
> >>         belongs_to :parent, assc_options
> >>         has n, :children, has_n_options
>
> >> note:  assign assc_options.dup to has_n_options, and update :required
> >> => false option in the last line.
>
> >> On Jan 15, 5:25 am, sliu <liusong1...@gmail.com> wrote:
>
> >> > Save a root in dm-is-tree yield an validation error:
>
> >> > @errors={:parent_id=>["Parent must not be blank"]}
>
> >> > that's because root(s) node parent_id is NULL, but dm-is-tree calls
> >> > "belongs_to :parent" doesn't carry :required => false option.
>
> >> >http://github.com/drove/dm-more/blob/master/dm-is-tree/lib/dm-is-tree...
>
> >> > assc_options = { :model => options[:model], :child_key => Array(options
> >> > [:child_key]) }
> >> >  should be:
> >> > assc_options = { :model => options[:model], :child_key => Array(options
> >> > [:child_key]) , :required => false}
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "DataMapper" group.
> > To post to this group, send email to datamap...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > datamapper+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/datamapper?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to datamap...@googlegroups.com.
To unsubscribe from this group, send email to 
datamapper+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to