Issues with rails4 and mongoid on production mode

ε祈祈猫儿з 提交于 2020-01-04 16:58:54

问题


I am working with rails 4.2.x and Mongoid . I am getting the following error when I try to run server in production mode ,but it runs smoothly on development mode, not sure why I am getting this error . I tried precomipling asses but no luck.

=> Booting Thin
=> Rails 4.2.1 application starting in production on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
/home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/actionview-4.2.1/lib/action_view/helpers/debug_helper.rb:25:in `debug': wrong number of arguments (0 for 1) (ArgumentError)
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/sprockets-rails-2.2.4/lib/sprockets/railtie.rb:131:in `block (2 levels) in <class:Railtie>'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:27:in `each'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/sprockets-rails-2.2.4/lib/sprockets/railtie.rb:127:in `block in <class:Railtie>'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:36:in `call'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:44:in `each'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/railties-4.2.1/lib/rails/application/finisher.rb:62:in `block in <module:Finisher>'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `instance_exec'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `run'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/railties-4.2.1/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /home/ratnakar/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
    from /home/ratnakar/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
    from /home/ratnakar/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
    from /home/ratnakar/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
    from /home/ratnakar/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `each'
    from /home/ratnakar/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `call'
    from /home/ratnakar/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
    from /home/ratnakar/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
    from /home/ratnakar/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/railties-4.2.1/lib/rails/initializable.rb:54:in `run_initializers'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/railties-4.2.1/lib/rails/application.rb:352:in `initialize!'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/railties-4.2.1/lib/rails/railtie.rb:194:in `public_send'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/railties-4.2.1/lib/rails/railtie.rb:194:in `method_missing'
    from /home/ratnakar/Projects/glimpse/Mar/23/glimpse/config/environment.rb:6:in `<top (required)>'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/backports-3.6.4/lib/backports/std_lib.rb:9:in `require'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/backports-3.6.4/lib/backports/std_lib.rb:9:in `require_with_backports'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `block in require'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
    from /home/ratnakar/Projects/glimpse/Mar/23/glimpse/config.ru:3:in `block in <main>'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/rack-1.6.0/lib/rack/builder.rb:55:in `instance_eval'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/rack-1.6.0/lib/rack/builder.rb:55:in `initialize'
    from /home/ratnakar/Projects/glimpse/Mar/23/glimpse/config.ru:in `new'
    from /home/ratnakar/Projects/glimpse/Mar/23/glimpse/config.ru:in `<main>'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/rack-1.6.0/lib/rack/builder.rb:49:in `eval'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/rack-1.6.0/lib/rack/builder.rb:49:in `new_from_string'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/rack-1.6.0/lib/rack/builder.rb:40:in `parse_file'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/rack-1.6.0/lib/rack/server.rb:299:in `build_app_and_options_from_config'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/rack-1.6.0/lib/rack/server.rb:208:in `app'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/railties-4.2.1/lib/rails/commands/server.rb:61:in `app'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/rack-1.6.0/lib/rack/server.rb:336:in `wrapped_app'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/rack-1.6.0/lib/rack/server.rb:272:in `start'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/railties-4.2.1/lib/rails/commands/server.rb:80:in `start'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:80:in `block in server'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `tap'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `server'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /home/ratnakar/.rvm/gems/ruby-2.1.5@glimpse/gems/railties-4.2.1/lib/rails/commands.rb:

回答1:


The error has been rised from mailers where I used "include ActionView::Helpers" out side the email class.

I got it fixed by keeping include ActionView::Helpers inside the class, I am not sure about this order of inclusion. I changed like the following

include ActionView::Helpers    
class EmailMailer < ActionMailer::Base

to

class EmailMailer < ActionMailer::Base
  include ActionView::Helpers

Hope it helps for someone , I am still searching about the order of including modules in classes , once I found required information I will post here .



来源:https://stackoverflow.com/questions/29227079/issues-with-rails4-and-mongoid-on-production-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!