I like this book because it is short, thin, and to the point. It gives me just enough information to get started. The examples worked fine until I tried the drag & drop one.
This is probably not the place to ask a question like this. But, please let me...
The error from drag & drop operation:
Processing SlideshowsController#add_photo (for 10.71.1.169 at 2007-10-10 14:44:43) [POST]
Session ID: 253902577ac03cf8a5c6393c3721dade
Parameters: {"action"=>"add_photo", "id"=>"photo_3", "controller"=>"slideshows"}
[4;35;1mSQL (0.002208)[0m [0m SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = 'slides'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
[0m
[4;36;1mSQL (0.000436)[0m [0;1mBEGIN[0m
[4;35;1mSlide Load (0.000000)[0m [0mRuntimeError: ERROR C42804 Margument of WHERE must be type boolean, not type integer Fparse_coerce.c L818 Rcoerce_to_boolean: SELECT * FROM slides WHERE (slideshow_id) ORDER BY position DESC LIMIT 1[0m
[4;36;1mSQL (0.000429)[0m [0;1mROLLBACK[0m
ActiveRecord::StatementInvalid (RuntimeError: ERROR C42804 Margument of WHERE must be type boolean, not type integer Fparse_coerce.c L818 Rcoerce_to_boolean: SELECT * FROM slides WHERE (slideshow_id) ORDER BY position DESC LIMIT 1):
........
Based on the above error, the problem seems to be with the generated select statement.
SELECT * FROM slides WHERE (slideshow_id) ORDER BY position DESC LIMIT 1)
Instead, it should be:
SELECT * FROM slides WHERE (slideshow_id = 3) ORDER BY position DESC LIMIT 1)
I also tried the following:
>> slide = Slide.find 1
>> slideshow = slide.slideshow
>> slideshow.slides.first.move_to_bottom
ActiveRecord::StatementInvalid: RuntimeError: ERROR C42804 Margument of AND must be type boolean, not type integer Fparse_coerce.c L818 Rcoerce_to_boolean: UPDATE slides SET position = (position - 1) WHERE (slideshow_id AND position > 1)
Same kind of problem. The update statement should be like:
UPDATE slides SET position = (position - 1) WHERE (slideshow_id = 3 AND position > 1)
I am not sure how to correct this problem. Please help.
|