rails 4.1 beta upgrade 'action-view no method error'

708 views Asked by At

I am trying to upgrade my rails application from rails 4.0.2 to 4.1 beta, I followed all the instructions given on http://edgeguides.rubyonrails.org/4_1_release_notes.html#action-pack-removals . Whenever i run my application, this is the error i get

/Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.1.0.beta1/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `action_view' for # (NoMethodError)
    from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/jquery-rails-3.0.4/lib/jquery/rails/railtie.rb:7:in `block in '
    from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.1.0.beta1/lib/active_support/lazy_load_hooks.rb:36:in `call'
    from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.1.0.beta1/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
    from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.1.0.beta1/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
    from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.1.0.beta1/lib/active_support/lazy_load_hooks.rb:44:in `each'
    from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-4.1.0.beta1/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
    from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.1.0.beta1/lib/rails/application.rb:121:in `initialize'
    from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.1.0.beta1/lib/rails/railtie.rb:171:in `new'
    from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.1.0.beta1/lib/rails/railtie.rb:171:in `instance'
    from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.1.0.beta1/lib/rails/application.rb:90:in `inherited'
    from /Users/surendra/Desktop/faces/config/application.rb:13:in `'
    from /Users/surendra/Desktop/faces/config/application.rb:12:in `'
    from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.1.0.beta1/lib/rails/commands/commands_tasks.rb:79:in `require'
    from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.1.0.beta1/lib/rails/commands/commands_tasks.rb:79:in `block in server'
    from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.1.0.beta1/lib/rails/commands/commands_tasks.rb:76:in `tap'
    from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.1.0.beta1/lib/rails/commands/commands_tasks.rb:76:in `server'
    from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.1.0.beta1/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
    from /Users/surendra/.rvm/gems/ruby-1.9.3-p448/gems/railties-4.1.0.beta1/lib/rails/commands.rb:17:in `'
    from bin/rails:4:in `require'
    from bin/rails:4:in `'

my application.rb file is this

require File.expand_path('../boot', __FILE__)

require "action_controller/railtie"
require "rails/test_unit/railtie"
require "sprockets/railtie"

Bundler.require(:default, Rails.env)

module ElitmusFaces
  class Application < Rails::Application
    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration should go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded.

    # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
    # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
    # config.time_zone = 'Central Time (US & Canada)'

    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
    # config.i18n.default_locale = :de
  end
end

Can you help me with this error,i would like to know where the error occured

1

There are 1 answers

0
Surendra Bobba On

I finally solved this problem, since I was not following rails convention in application.rb, I had to dig deeper to find where the problem is. It looks like the problem is caused by

 require "action_controller/railtie"

And the error it is showing is, actionview method not found. So I just replaced that line with

 require "action_view/railtie"

I got this info from https://github.com/rails/rails/pull/7356

it seems that actionview is decoupled from actionpack, so i needed to add it myself.