Hey,
Using Ruby 1.8.5, postgres-pr-0.4.0, activerecord-1.15.2, Rails 1.2.2
and PostgreSQL 8.2.3. I''m following the O''Reilly book
"Ruby on
Rails", so you can tell I know precious little of what I''m doing
;-)
Well, I''ve created some models, and was working through examples, and
executed the following from a console:
>> show = Slideshow.find 1
=> #<Slideshow:0x7f2d7588
@attributes={"name"=>"Interesting pictures",
"id"=>"1", "created_at"=>"2007-02-17
19:41:30.703"}>>> show.slides.first.photo.filename
=> "balboa_park.jpg">> show.slides.first.move_to_bottom
ActiveRecord::StatementInvalid: PGError: ERROR: argument of AND must
be type boolean, not type integer
: UPDATE slides SET position = (position - 1) WHERE (slideshow_id AND
position > 1)
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/
active_record/connection_adapters/abstract_adapter.rb:128:in `log''
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/
active_record/connection_adapters/postgresql_adapter.rb:152:in
`execute''
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/
active_record/connection_adapters/postgresql_adapter.rb:162:in
`update''
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/
active_record/base.rb:497:in `update_all''
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/
active_record/acts/list.rb:210:in `decrement_positions_on_lower_items''
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/
active_record/acts/list.rb:106:in `move_to_bottom''
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/
active_record/connection_adapters/abstract/database_statements.rb:
59:in `transaction''
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/
active_record/transactions.rb:95:in `transaction''
from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.2/lib/
active_record/acts/list.rb:105:in `move_to_bottom''
from (irb):3
The error is pretty specific. I''m thinking the where clause should be
(slideshow_id NOTNULL AND position > 1)?
Any help?
Thanks,
Rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---