Forum: Ruby on Rails Updating sqLite records through migrations

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
yachtman (Guest)
on 2009-02-13 04:08
(Received via mailing list)
Here is probably a simple question for most of you, where I can't seem
to update records in sqlite3 through a migration. Any suggestions
would be most appreciated....

With this code, nothing happens:
------
class AlterDataInDesigns < ActiveRecord::Migration
  def self.up
    execute "UPDATE designs SET name = 'Liquid' and file_name =
'liquid' WHERE id = '3'"
  end
...
 end
------


With this code, it changes the name to '0'??? (the difference is the
';' added to the end)
------
class AlterDataInDesigns < ActiveRecord::Migration
  def self.up
    execute "UPDATE designs SET name = 'Liquid' and file_name =
'liquid' WHERE id = '3';"
  end
...
 end
yachtman (Guest)
on 2009-02-13 04:32
(Received via mailing list)
SOLVED.

Due to my tunnel vision on the statement and missing the incorrect
'and', I see now the answer is.
---
execute "UPDATE designs SET name = 'Liquid', file_name ='liquid' WHERE
id = '3'"
---

It seems that I would have gotten an error on any of my incorrect
statements, but none were returned. Oh well.
This topic is locked and can not be replied to.