TypeError (wrong argument type Class (expected Module)) | Problem when upgrading from rails 2 to rails 3 (and also ruby version)



TypeError (wrong argument type Class (expected Module)):
  actionpack (3.0.10) lib/abstract_controller/helpers.rb:123:in `include'
  actionpack (3.0.10) lib/abstract_controller/helpers.rb:123:in `block in add_template_helper'
  actionpack (3.0.10) lib/abstract_controller/helpers.rb:123:in `module_eval'
  actionpack (3.0.10) lib/abstract_controller/helpers.rb:123:in `add_template_helper'
  actionpack (3.0.10) lib/abstract_controller/helpers.rb:98:in `block in helper'
  actionpack (3.0.10) lib/abstract_controller/helpers.rb:97:in `each'
  actionpack (3.0.10) lib/abstract_controller/helpers.rb:97:in `helper'
  actionpack (3.0.10) lib/action_controller/base.rb:228:in `inherited'
  app/controllers/application_controller.rb:1:in `'

Maybe one of your helpers has been accidentally redefined as a “Class”, change it to “module”

To check whether this problem exists:

Go to project root directory and then run these commands to list the helpers which has been redefined as Class.


cd app/helpers

egrep -Ri "class .*Helper" *

Stackoverflow

Advertisements

I am Senior Software Engineer. I love reading, writing, sharing,developing, hiking, movies, trips, mountains, brooks, hills etc.

Tagged with: ,
Posted in Ruby on Rails
2 comments on “TypeError (wrong argument type Class (expected Module)) | Problem when upgrading from rails 2 to rails 3 (and also ruby version)
  1. Marc Donovan says:

    You solved my problem. Thanks!
    It’s very easy to open a new Helper and just start typing without thinking. Then later you get this error with NO clue what is going on.

    My stack trace was more mysterious

    wrong argument type Class (expected Module) (TypeError)
    ./app/controllers/application_controller.rb:1:in `’
    ./app/controllers/deals_controller.rb:1:in `’
    ./features/user.feature:5:in `When I am not logged in’

  2. taimoor.changaiz says:

    My pleasure!

    Are you still getting any problem? I did not get what you want to convey about your stack trace

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

StackOverFlow
Categories
Archives
%d bloggers like this: