jeudi 16 novembre 2017

Problems setting development environment

I have a rails 3 app working in a development environment using tmuxinator. like this:

for running the server:

RAILS_ENV=development bundle exec rails server

and for the resque

RAILS_ENV=development bundle exec rake resque:pool --trace

when I run a resque task going by the web it work OK, but when I try to run this in console (inf-ruby-console-rails with emacs or rails console)

undefined method `find' for Period:Class

it seems that activerecord is not loaded but in the console I can get the Period.find method

2.1.6 :002 > period = Period.find(225)
   (1.4ms)  SELECT table_name FROM information_schema.views WHERE table_schema = SCHEMA()
  Period Load (0.8ms)  SELECT `periods`.* FROM `periods` WHERE `periods`.`id` = 225 LIMIT 1
 => #<Period id:225 ....>
 => true

2.1.6 :008 > Activity.new({ scope: period.class, type: :update, model: period,user: nil}).log #= this launch the backgorund task
 => true

also when I launch the rake task I get this: (class Period has a class method called notify_expired, on console work but fails executing the resque task for the same reason) and sometimes the resque task doesn't find the method

Aucun commentaire:

Enregistrer un commentaire