ActiveRecord::StatementInvalid
|
|
Hello, i deployed my application with succes :) But i have a lil problem when if u test this page http://www.expay.uag-histoire.com/faq_categories You will see this error message ActiveRecord::StatementInvalid in Faq categoriesController#index ActiveRecord::StatementInvalid I don’t realy understand ‘cause in local, i don’t have this problem … lil help ? Thanks |
|
|
I get a more general 503 error when clicking that link, but that error would mean that there’s either something wrong with the SQL active record assembled for the db, or there’s something messed up with your db structure at PA (that makes the SQL invalid for that DB). Since it works on your local machine, I’d start looking at the second possibility. |
|
|
ActiveRecord::StatementInvalid (ActiveRecord::StatementInvalid): /vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:279:in `table_structure’ /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/core_ext/object/misc.rb:23:in `returning’ /vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:278:in `table_structure’ /vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb:216:in `columns’ /vendor/rails/activerecord/lib/active_record/base.rb:760:in `columns’ /vendor/rails/activerecord/lib/active_record/base.rb:773:in `column_names’ /vendor/rails/activerecord/lib/active_record/base.rb:786:in `column_methods_hash’ /vendor/rails/activerecord/lib/active_record/base.rb:1262:in `all_attributes_exists?’ /vendor/rails/activerecord/lib/../../activesupport/lib/active_support/inflector.rb:162:in `all?’ /vendor/rails/activerecord/lib/active_record/base.rb:1262:in `each’ /vendor/rails/activerecord/lib/active_record/base.rb:1262:in `all?’ /vendor/rails/activerecord/lib/active_record/base.rb:1262:in `all_attributes_exists?’ /vendor/rails/activerecord/lib/active_record/base.rb:1196:in `method_missing’ /app/controllers/faq_categories_controller.rb:20:in `index’ /vendor/rails/actionpack/lib/action_controller/base.rb:1068:in `send’ /vendor/rails/actionpack/lib/action_controller/base.rb:1068:in `perform_action_without_filters’ /vendor/rails/actionpack/lib/action_controller/filters.rb:635:in `call_filter’ /vendor/rails/actionpack/lib/action_controller/filters.rb:637:in `call_filter’ /vendor/rails/actionpack/lib/action_controller/filters.rb:641:in `call_filter’ /vendor/rails/actionpack/lib/action_controller/filters.rb:438:in `call’ /vendor/rails/actionpack/lib/action_controller/filters.rb:640:in `call_filter’ /vendor/rails/actionpack/lib/action_controller/filters.rb:641:in `call_filter’ /vendor/rails/actionpack/lib/action_controller/filters.rb:438:in `call’ /vendor/rails/actionpack/lib/action_controller/filters.rb:640:in `call_filter’ /vendor/rails/actionpack/lib/action_controller/filters.rb:641:in `call_filter’ /vendor/rails/actionpack/lib/action_controller/filters.rb:449:in `call’ /vendor/rails/actionpack/lib/action_controller/filters.rb:640:in `call_filter’ /vendor/rails/actionpack/lib/action_controller/filters.rb:622:in `perform_action_without_benchmark’ /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:66:in `perform_action_without_rescue’ /usr/lib/ruby/1.8/benchmark.rb:293:in `measure’ /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:66:in `perform_action_without_rescue’ /vendor/rails/actionpack/lib/action_controller/rescue.rb:111:in `perform_action’ /vendor/rails/actionpack/lib/action_controller/base.rb:427:in `send’ /vendor/rails/actionpack/lib/action_controller/base.rb:427:in `process_without_filters’ /vendor/rails/actionpack/lib/action_controller/filters.rb:627:in `process_without_session_management_support’ /vendor/rails/actionpack/lib/action_controller/session_management.rb:114:in `process’ /vendor/rails/actionpack/lib/action_controller/base.rb:330:in `process’ /vendor/rails/railties/lib/dispatcher.rb:41:in `dispatch’ /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/rails.rb:84:in `process’ /usr/lib/ruby/1.8/sync.rb:229:in `synchronize’ /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/rails.rb:83:in `process’ /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:580:in `process_client’ /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:579:in `each’ /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:579:in `process_client’ /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:686:in `run’ /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:686:in `initialize’ /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:686:in `new’ /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:686:in `run’ /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:673:in `initialize’ /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:673:in `new’ /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel.rb:673:in `run’ /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/configurator.rb:267:in `run’ /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/configurator.rb:266:in `each’ /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/configurator.rb:266:in `run’ /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/bin/mongrel_rails:127:in `run’ /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/lib/mongrel/command.rb:211:in `run’ /usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13.4/bin/mongrel_rails:231
db structure == shema.rb ? ActiveRecord::Schema.define(:version => 8) do
end |
|
|
You use sqlite both locally and at PA? |
|
|
Oh, and I do see that error now when I click, though I didn’t before. Odd. |
|
|
Yes, why ? i can’t use sqlite at PA
So , your diagnostic ? :) |
|
|
You should be able to, I was just trying to figure out if that sort of difference might be causing a problem. Do you mind pasting the index action of your faq_categories_controller and pointing out which line is 20? |
|
|
Oh, and if you have sqlite generating any logs, check those for anything interesting. |
|
|
@faq_categories = FaqCategory.find_all_by_estvisible(1) |
|
|
Ok. After some digging through the source, the part that’s throwing the exception is
I’m assuming that the table_name used in this case would be faq_categories (unless you specified it to be something different). So, if you open up sqlite and try PRAGMA table_info(faq_categories) (can try this on PA and locally, I think), what happens? |
|
|
at Local $ sqlite3 db/expay_corporate_development SQLite version 3.1.3 Enter ”.help” for instructions sqlite> PRAGMA table_info(faq_categories) ; 0|id|INTEGER|99||1 1|libellefr|varchar(255)|0||0 2|estvisible|integer|0||0 sqlite> at PA sqlite3 expay/current/db/expay_corporate_production SQLite version 3.3.3 Enter ”.help” for instructions sqlite> PRAGMA table_info(faq_categories) ; sqlite> |
|
|
Hm. Well, the command line shows the same problem as the app. I don’t have access to your sqlite instance, but you’d need to figure out why it’s not able to get any info for that table when done at PA (double-check that it exists, and has permissions to read it, and such, I suppose). |
|
|
I check the permission in the terminal at PA $ ls -l expay/current/db/ total 44 -rw-r—r—1 vu2016 vu2016 30720 Nov 30 13:25 expay_corporate_development -rw-r—r—1 vu2016 vu2016 0 Nov 30 13:26 expay_corporate_production -rw-r—r—1 vu2016 vu2016 7168 Nov 30 13:25 expay_corporate_test drwxr-xr-x 3 vu2016 vu2016 255 Nov 30 13:25 migrate -rw-r—r—1 vu2016 vu2016 2385 Nov 30 13:25 schema.rb |
|
|
The permissions look fine there. What result does sqlite> .schema give you? |
|
|
Um, actually, nevermind. Considering the error I see at http://www.expay.uag-histoire.com/users , I think you just need to run rake migrate. Or, if you did, work on figuring out why it failed. (Error is SQLite3::SQLException: no such table: users: SELECT * FROM users ) |
|
|
I remigrate my db production in local pc-mq-dsi3:~/Documents/Coding-Dev/expay bmichelin$ rake RAILS_ENV=production db :migrate (in /Users/bmichelin/Documents/Coding-Dev/expay) CreateFaqcategories: migrating =========================================== —create_table(:faq_categories) → 0.1335s CreateFaqcategories: migrated (0.1337s) ================================== CreateQuestions: migrating =============================================== —create_table(:questions) → 0.0465s CreateQuestions: migrated (0.0468s) ====================================== CreateFaqComments: migrating ============================================= —create_table(:faq_comments) → 0.0304s CreateFaqComments: migrated (0.0307s) ==================================== CreateUsers: migrating =================================================== —create_table(:users) → 0.0343s CreateUsers: migrated (0.0346s) ========================================== CreateRoles: migrating =================================================== —create_table(:roles) → 0.0359s CreateRoles: migrated (0.0361s) ========================================== CreateJetons: migrating ================================================== —create_table(:jetons) → 0.0860s CreateJetons: migrated (0.0862s) ========================================= CreateJetonsComments: migrating ========================================== —create_table(:jetons_comments) → 0.0584s CreateJetonsComments: migrated (0.0586s) ================================= CreateVotes: migrating =================================================== —create_table(:votes) → 0.0430s CreateVotes: migrated (0.0432s) ==========================================and also at PA (in /var/www/virtual/uag-histoire.com/expay/releases/20061130212424)
i have always same problem my schema sqlite3 db/expay_corporate_production SQLite version 3.3.3 Enter ”.help” for instructions sqlite> .shema unknown command or invalid arguments: “shema”. Enter ”.help” for help sqlite> .schema sqlite> |
|
|
When I asked you to try the PRAGMA command, you did it in expay/current/db/expay_corporate_production (I’m assuming the full path is /var/www/virtual/uag-histoire.com/expay/current/db/expay_corporate_production). But you did the migrate command in /var/www/virtual/uag-histoire.com/expay/releases/20061130212424. If you run rake db:migrate from /var/www/virtual/uag-histoire.com/expay/current/, do you still have the same problem? Also, did you specify the production environment for migrate on PA’s server? (If you run .schema in db/expay_corporate_development, does it show anything?). |
|
|
Yes i added production in mongrel_config http://pastie.caboo.se/25312
|
|
|
Mongrel’s configuration doesn’t effect rake; it only affects what the app itself runs in. Since your development db seems to have everything it’s supposed to, and your app is running in production, I’m guessing your just need to run rake RAILS_ENV=production db:migrate on positron (and then probably stop/start (not restart) your mongrel cluster). |
|
|
local http://pastie.caboo.se/25599 PA http://pastie.caboo.se/25600 Same thing :( http://www.expay.uag-histoire.com/users/new I deleted my application at PA and redeployed my application but always same thing I really don’t understand … |
|
|
Um, rake RAILS_ENV=production db:migrate should’ve been run at PA, not locally. |
|
|
Ok http://pastie.caboo.se/25730 I forgot something ? Other people are this problem since they update for Rails 1.2 (like me) http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/068b8085a578031e/ff7069705396ebef#ff7069705396ebef |
|
|
It works now. You needed to stop/start your mongrel cluster after doing the rake migrate (as I mentioned in my post on Dec 1). |
|
|
oups i forgot to restart sorry. Thanks a lot ;) |
|
|
No problem. |