hunkybill
unread,Dec 1, 2008, 2:58:25 PM12/1/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Comatose Plugin
Hi,
I have a very nice Comatose installation, with one small issue bugging
me. From the rake task data:import, line 60
target = (root == '') ? ComatosePage.root : ComatosePage.find_by_path
(root)
I bootstrap my application using a rake task. When I do this, I use
the same line from the Comatose Migration to create a Root, namely
root = ComatosePage.create( :title=>'Root', :body=>"h1. Comatose Root
Page", :author=>'System' )
When run inside the migration rake task, this line executes with no
problem, and a call to ComatosePage.root returns this node. However, I
noticed with my bootstrap, ComatosePage.root was always returning nil.
Closer inspections revealed my root create failing with a message
about no Parent. I see no parent_id in my call, so I added :parent_id
=> nil. Same validation error. The ComatosePage model has this line...
validates_presence_of :parent_id, :on=>:create, :message=>"must be
present"
Which leads me to now question how the migration works in the first
place! The migration is clearly using the Model for ComatosePage,
which clearly has this validator, which fails when I go rake or script/
console... but inside the migration it works fine and dandy....
Can anyone shed light on this for me.
Thanks