I'm using sitemap generator to generate my sitemap.
I've tested all my code locally and I was ready to try it on the online webserver and the following happend when I tried to refresh the Sitemap bundle exec rake sitemap:refresh
:
ActiveRecord::StatementInvalid: Could not find table 'settings'
Code executed in sitemap.rb:
SitemapGenerator::Sitemap.create do
settings = Settings.first
languages = []
languages << "en" if settings.lang_en
languages << "fr" if settings.lang_fr
languages << "nl" if settings.lang_nl
languages << "de" if settings.lang_de
end
Result of same code in console on the webserver:
[1] pry(main)> settings = Settings.first
Settings Load (2.0ms) SELECT "settings".* FROM "settings" LIMIT 1
Settings::Translation Load (2.0ms) SELECT "setting_translations".* FROM "setting_translations" WHERE "setting_translations"."setting_id" = 1
#Output here
[2] pry(main)> languages = []
=> []
[3] pry(main)> languages << "en" if settings.lang_en
=> nil
[4] pry(main)> languages << "fr" if settings.lang_fr
=> ["fr"]
[5] pry(main)> languages << "nl" if settings.lang_nl
=> ["fr", "nl"]
[6] pry(main)> languages << "de" if settings.lang_de
=> nil
[7] pry(main)> languages
=> ["fr", "nl"]
Full error:
rake aborted!
ActiveRecord::StatementInvalid: Could not find table 'settings'
/home/<customer_here>/apps/default/releases/324/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/connection_adapters/sqlite_adapter.rb:472:in `table_structure'
/home/<customer_here>/apps/default/releases/324/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/connection_adapters/sqlite_adapter.rb:346:in `columns'
/home/<customer_here>/apps/default/releases/324/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/connection_adapters/schema_cache.rb:12:in `block in initialize'
/home/<customer_here>/apps/default/releases/324/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/model_schema.rb:229:in `yield'
/home/<customer_here>/apps/default/releases/324/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/model_schema.rb:229:in `default'
/home/<customer_here>/apps/default/releases/324/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/model_schema.rb:229:in `columns'
/home/<customer_here>/apps/default/releases/324/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/model_schema.rb:238:in `columns_hash'
/home/<customer_here>/apps/default/releases/324/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/locking/optimistic.rb:131:in `locking_enabled?'
/home/<customer_here>/apps/default/releases/324/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/relation.rb:170:in `exec_queries'
/home/<customer_here>/apps/default/releases/324/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/relation.rb:160:in `block in to_a'
/home/<customer_here>/apps/default/releases/324/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/explain.rb:34:in `logging_query_plan'
/home/<customer_here>/apps/default/releases/324/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/relation.rb:159:in `to_a'
/home/<customer_here>/apps/default/releases/324/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/relation/finder_methods.rb:381:in `find_first'
/home/<customer_here>/apps/default/releases/324/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/relation/finder_methods.rb:122:in `first'
/home/<customer_here>/apps/default/releases/324/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.18/lib/active_record/querying.rb:5:in `first'
/home/<customer_here>/apps/default/releases/324/config/sitemap.rb:8:in `block in run'
/home/<customer_here>/apps/default/releases/324/vendor/bundle/ruby/1.9.1/gems/sitemap_generator-5.0.5/lib/sitemap_generator/interpreter.rb:59:in `instance_eval'
/home/<customer_here>/apps/default/releases/324/vendor/bundle/ruby/1.9.1/gems/sitemap_generator-5.0.5/lib/sitemap_generator/interpreter.rb:59:in `eval'
/home/<customer_here>/apps/default/releases/324/vendor/bundle/ruby/1.9.1/gems/sitemap_generator-5.0.5/lib/sitemap_generator/link_set.rb:40:in `create'
/home/<customer_here>/apps/default/releases/324/vendor/bundle/ruby/1.9.1/gems/sitemap_generator-5.0.5/lib/sitemap_generator.rb:42:in `method_missing'
/home/<customer_here>/apps/default/releases/324/config/sitemap.rb:5:in `run'
/home/<customer_here>/apps/default/releases/324/vendor/bundle/ruby/1.9.1/gems/sitemap_generator-5.0.5/lib/sitemap_generator/interpreter.rb:76:in `instance_eval'
/home/<customer_here>/apps/default/releases/324/vendor/bundle/ruby/1.9.1/gems/sitemap_generator-5.0.5/lib/sitemap_generator/interpreter.rb:76:in `run'
/home/<customer_here>/apps/default/releases/324/vendor/bundle/ruby/1.9.1/gems/sitemap_generator-5.0.5/lib/sitemap_generator/tasks.rb:51:in `block (2 levels) in <top (required)>'
Tasks: TOP => sitemap:refresh => sitemap:create
(See full trace by running task with --trace)
Gem Used: https://github.com/kjvarga/sitemap_generator
OS: Mac OS X 10.9.4
Rails Version: Rails 3.2.18
Ruby Version: ruby 1.9.3p484
Kind regards.
EDIT1: tried to change the variable settings - same error
langu_settings = Settings.first
languages = []
languages << "en" if langu_settings.lang_en
languages << "fr" if langu_settings.lang_fr
languages << "nl" if langu_settings.lang_nl
languages << "de" if langu_settings.lang_de
Try running it like this
bundle exec rake sitemap:refresh RAILS_ENV=production
.