0

I'm trying to introduce dynamic_sitemaps over resources with friendly_id. The issue is the production rails (rake / rails c) doesn't see the slug method. I've try to specify it by force by specifying an attr_accessible :slug, but it doesn't help either.

$ rake sitemap:generate
Generating sitemap...
rake aborted!
undefined method `slug' for #<Article:0xa9e4d14>

The funny thing it works smoothly on the local environment, and it should not be so much different with the capistrano/rvm deployment.

The column exists in the DB and is used by the rails app itself (which works fine too).

Added: it should be tied to either the environment or the specific gem version issue, but I'm not sure which one is the trouble, and how to debug it. The same pair works good for a different project with a pretty similar libraries bundle.

lifecoder
  • 1,424
  • 1
  • 14
  • 29

1 Answers1

0

As the capistrano always do the dirty work, I forgot about the RAILS_ENV environment variable - so the console and cron job tried to operate against the dev DB and obviously failed.

lifecoder
  • 1,424
  • 1
  • 14
  • 29
  • What do you mean by this? For me everything works smoothly on local. Everything works smoothly on production except for creating an instance of the model in question - then i get an undefined method slug error. – colemerrick Jul 15 '16 at 19:09