Forum: Ruby on Rails RoR: 'Expected [.] to define Job

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Feb7627bff58033d8e7d7e22b7789df9?d=identicon&s=25 Martin Cigorraga (i90rr)
on 2016-10-26 20:51
Hi all,

I have almost no experience with Ruby/RoR so please have some patience
if I'm not seeing the 'evident' thing here; I've been scratching my head
for hours for no avail.

Recently the infrastructure on where this RoR code runs was migrated (I
don't have the information regarding the old OS and software stacks) and
now it throws the following error whenever we try to run it:

$ RAILS_ENV=production rake update_database_from_cmd["/foo/bar"]
WARNING: 'require 'rake/rdoctask'' is deprecated.  Please use 'require
'rdoc/task' (in RDoc 2.4.2+)' instead.
    at
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/rake/rdoctask.rb
WARNING: Global access to Rake DSL methods is deprecated.  Please
include
    ...  Rake::DSL into classes and modules which use the Rake DSL
methods.
WARNING: DSL method Djln::Application#task called at
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/railties-3.0.7/lib/rails/application.rb:215:in
`initialize_tasks'
** Invoke update_database_from_cmd (first_time)
** Invoke environment (first_time)
** Execute environment
[deprecated] I18n.enforce_available_locales will default to true in the
future. If you really want to skip validation of your locale you can set
I18n.enforce_available_locales = false to avoid this message.
** Execute update_database_from_cmd
rake aborted!
Expected /foo/bar/html/bar1/bar2/app/models/job.rb to define Job
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:492:in
`load_missing_constant'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:183:in
`block in const_missing'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:181:in
`each'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:181:in
`const_missing'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activesupport-3.0.7/lib/active_support/inflector/methods.rb:124:in
`block in constantize'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activesupport-3.0.7/lib/active_support/inflector/methods.rb:123:in
`each'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activesupport-3.0.7/lib/active_support/inflector/methods.rb:123:in
`constantize'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activesupport-3.0.7/lib/active_support/core_ext/string/inflections.rb:43:in
`constantize'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activemodel-3.0.7/lib/active_model/observing.rb:182:in
`observed_class'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activemodel-3.0.7/lib/active_model/observing.rb:175:in
`observed_classes'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activemodel-3.0.7/lib/active_model/observing.rb:195:in
`observed_classes'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activemodel-3.0.7/lib/active_model/observing.rb:191:in
`initialize'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activerecord-3.0.7/lib/active_record/observer.rb:94:in
`initialize'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/singleton.rb:141:in
`new'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/singleton.rb:141:in
`block in instance'
<internal:prelude>:10:in `synchronize'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/singleton.rb:139:in
`instance'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activemodel-3.0.7/lib/active_model/observing.rb:66:in
`instantiate_observer'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activemodel-3.0.7/lib/active_model/observing.rb:39:in
`block in instantiate_observers'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activemodel-3.0.7/lib/active_model/observing.rb:39:in
`each'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activemodel-3.0.7/lib/active_model/observing.rb:39:in
`instantiate_observers'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activerecord-3.0.7/lib/active_record/railtie.rb:83:in
`block (2 levels) in <class:Railtie>'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activesupport-3.0.7/lib/active_support/lazy_load_hooks.rb:36:in
`instance_eval'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activesupport-3.0.7/lib/active_support/lazy_load_hooks.rb:36:in
`execute_hook'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activesupport-3.0.7/lib/active_support/lazy_load_hooks.rb:43:in
`block in run_load_hooks'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activesupport-3.0.7/lib/active_support/lazy_load_hooks.rb:42:in
`each'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activesupport-3.0.7/lib/active_support/lazy_load_hooks.rb:42:in
`run_load_hooks'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activerecord-3.0.7/lib/active_record/base.rb:1904:in
`<top (required)>'
/foo/bar/html/bar1/bar2/app/models/job.rb:1:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in
`require'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in
`block in require'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:227:in
`load_dependency'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in
`require'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:346:in
`require_or_load'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:491:in
`load_missing_constant'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:183:in
`block in const_missing'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:181:in
`each'
/usr/local/rvm/gems/ruby-1.9.3-p551/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:181:in
`const_missing'
/foo/bar/html/bar1/bar2/lib/tasks/load_xls_data.rake:244:in `block in
<top (required)>'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/rake/task.rb:205:in
`call'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/rake/task.rb:205:in
`block in execute'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/rake/task.rb:200:in
`each'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/rake/task.rb:200:in
`execute'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/rake/task.rb:158:in
`block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/monitor.rb:211:in
`mon_synchronize'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/rake/task.rb:151:in
`invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/rake/task.rb:144:in
`invoke'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/rake/application.rb:116:in
`invoke_task'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/rake/application.rb:94:in
`block (2 levels) in top_level'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/rake/application.rb:94:in
`each'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/rake/application.rb:94:in
`block in top_level'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/rake/application.rb:133:in
`standard_exception_handling'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/rake/application.rb:88:in
`top_level'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/rake/application.rb:66:in
`block in run'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/rake/application.rb:133:in
`standard_exception_handling'
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/1.9.1/rake/application.rb:63:in
`run'
/usr/local/rvm/gems/ruby-1.9.3-p551@global/gems/rake-0.9.2.2/bin/rake:32:in
`<top (required)>'
/usr/local/rvm/gems/ruby-1.9.3-p551/bin/rake:23:in `load'
/usr/local/rvm/gems/ruby-1.9.3-p551/bin/rake:23:in `<main>'
/usr/local/rvm/gems/ruby-1.9.3-p551/bin/ruby_executable_hooks:15:in
`eval'
/usr/local/rvm/gems/ruby-1.9.3-p551/bin/ruby_executable_hooks:15:in
`<main>'
Tasks: TOP => update_database_from_cmd

The code surely looks it could use some update and I will push towards
that direction but in the interim I'm trying to understand where the
issue lies here, if I'm missing a GEM or any other kind of dependency or
if it's just an issue with the code.

OS: Amazon Linux 2016.03
Ruby versions installed: 1.8, 1.9 and 2.0 (all through the OS packet
manager)
$ ruby -v
ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]
$ rake -V
rake, version 11.2.2

Rakefile content: http://pastebin.com/1csdnqS2
job.rb: http://pastebin.com/hceyPrFV

Please let me know if there's any information missing that can help you
get the full picture.
Thanks :)
Feb7627bff58033d8e7d7e22b7789df9?d=identicon&s=25 Martin Cigorraga (i90rr)
on 2016-10-26 20:56
I forgot to mention that I found what seems to be a similar issue in
this forum: https://www.ruby-forum.com/topic/107385 but still can't make
anything out it.
This topic is locked and can not be replied to.