Hi, I''ve searched with no end for any clue as to why I get the following error: SQLite3::SQLException: SQL logic error or missing database: INSERT INTO estudio_stages ("updated_at", "estudio_id", "created_at", "stage_id") VALUES(''2007-07-23 16:32:42'', 2, ''2007-07-23 16:32:42'', 4) ...when accesing a certain action in a controller... but if I execute that SQL code directly in sqlite, or call the appropiate method in my model from the console, it works! So what gives? Thanks for any help! - Ivan V. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ivan V. wrote:> Hi, > > I''ve searched with no end for any clue as to why I get the following > error: > > SQLite3::SQLException: SQL logic error or missing database: INSERT INTO > estudio_stages ("updated_at", "estudio_id", "created_at", "stage_id") > VALUES(''2007-07-23 16:32:42'', 2, ''2007-07-23 16:32:42'', 4) > > ...when accesing a certain action in a controller... but if I execute > that SQL code directly in sqlite, or call the appropiate method in my > model from the console, it works! > > So what gives? > > Thanks for any help! > > - Ivan V.For a second there I thought I had a clue... Here''s part of the trace: vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:135:in `log'' vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:132:in `execute'' vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:341:in `catch_schema_changes'' vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:132:in `execute'' vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:147:in `insert'' So there''s a method named ''catch_schema_changes'' in the sqlite adapter, and I read somewhere that SQLite doesn''t support renaming columns, so I thought if I deleted and then re-created the schema.rb file then it might just work (don''t ask me the logic behind such reasoning), but it doesn''t... -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ivan V. wrote:> Hi, > > I''ve searched with no end for any clue as to why I get the following > error: > > SQLite3::SQLException: SQL logic error or missing database: INSERT INTO > estudio_stages ("updated_at", "estudio_id", "created_at", "stage_id") > VALUES(''2007-07-23 16:32:42'', 2, ''2007-07-23 16:32:42'', 4) > > ...when accesing a certain action in a controller... but if I execute > that SQL code directly in sqlite, or call the appropiate method in my > model from the console, it works! > > So what gives? > > Thanks for any help! > > - Ivan V.This just gets weirder... If I debug the application with NetBeans and set a breakpoint on the AR object''s save method to try and see where the problem might be, I step into a few statements, then NetBeans seem to not want to step any further, so I press "Continue" to finish the remaining calls... and then it works..., with no error thrown... Just now I also tried executing directly with AR::Base.connection.execute... no luck :( -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ivan V. wrote:> Ivan V. wrote: >> Hi, >> >> I''ve searched with no end for any clue as to why I get the following >> error: >> >> SQLite3::SQLException: SQL logic error or missing database: INSERT INTO >> estudio_stages ("updated_at", "estudio_id", "created_at", "stage_id") >> VALUES(''2007-07-23 16:32:42'', 2, ''2007-07-23 16:32:42'', 4) >> >> ...when accesing a certain action in a controller... but if I execute >> that SQL code directly in sqlite, or call the appropiate method in my >> model from the console, it works! >> >> So what gives? >> >> Thanks for any help! >> >> - Ivan V. > > This just gets weirder... If I debug the application with NetBeans and > set a breakpoint on the AR object''s save method to try and see where the > problem might be, I step into a few statements, then NetBeans seem to > not want to step any further, so I press "Continue" to finish the > remaining calls... and then it works..., with no error thrown... > > Just now I also tried executing directly with > AR::Base.connection.execute... no luck :(I dare you to find another hack that can be called the fugliest hack ever: if ENV["RAILS_ENV"] == "development" created = Time.now.strftime(''%Y-%m-%d %H:%M:%S'') sql = "INSERT INTO estudio_stages (''updated_at'', ''estudio_id'', ''created_at'', ''stage_id'') VALUES(''#{created}'', #{self.id}, ''#{created}'', #{s.id})" a = %x[sqlite3 #{RAILS_ROOT}/db/development.db "#{sql}"] self.save! self.reload else self.stages.build :stage_id => s.id self.save end Sigh... -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---