Upgrading to rails 5.0

Hi there,

I’m upgrading an app from rails 4.2.7 to 5.0.4.

I have updated the binary files through this command $rails app:update, and so far so good.

However, when i run this command $rails db:migrate, I get the following error:

rails aborted!

NoMethodError: undefined method `scheduler’

and the code it points is to this block: (the red is what is causing the error.

if !defined?(Rails::Console) && \

File.basename($0) != ‘rake’ && \

Rails.configuration.scheduler

scheduler_pid_file = File.join(Rails.root, “tmp”, “scheduler.pid”).to_s

Scheduler::start_unless_running scheduler_pid_file

end

I’m using gem ‘rufus-scheduler’, ‘~> 3.4.2’

And I followed this guide to upgrade: https://hashrocket.com/blog/posts/how-to-upgrade-to-rails-5#3-update-rails-binaries-and-configurations

Do you have any idea how to solve this?

Thank you for your time,

João Bordalo

You may want to open this as an issue on the gem’s issue tracker: https://github.com/jmettraux/rufus-scheduler/issues

This is not a Rails problem, but more of a compatibility issue with the gem.

Hi, again,

I forgot to mention that block of code belongs to the file config/initializers/scheduler.rb

Additionally, I tried to put rufus-scheduler to the verson that worked in rails 4.2.7. Still, no effect.

That’s highly possible what you said.

Thank you for your help and after I have some development, I will tell

The problem isn’t related to the compatibility.

just replace to:

Rails.configuration.respond_to?(:scheduler)

on the line that I pointed