Uninitialized constant error on spree upgrade - ruby-on-rails

I am trying to upgrade from spree 0.7 to spree 1.0.7. After successful bundle install I am fetting the following error:
/config/initializers/product_review_ratings.rb:12:in `<class:Config>': uninitialized constant Spree::ProductReviewsRatings::Config::PreferenceAccess (NameError)
from /home/nish/repos/spree/voylla_website_production/config/initializers/product_review_ratings.rb:10:in `<module:ProductReviewsRatings>'
from /home/nish/repos/spree/voylla_website_production/config/initializers/product_review_ratings.rb:2:in `<module:Spree>'
from /home/nish/repos/spree/voylla_website_production/config/initializers/product_review_ratings.rb:1:in `<top (required)>'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#spreeTest/gems/railties-3.1.12/lib/rails/engine.rb:556:in `block (2 levels) in <class:Engine>'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#spreeTest/gems/railties-3.1.12/lib/rails/engine.rb:555:in `each'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#spreeTest/gems/railties-3.1.12/lib/rails/engine.rb:555:in `block in <class:Engine>'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#spreeTest/gems/railties-3.1.12/lib/rails/initializable.rb:30:in `instance_exec'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#spreeTest/gems/railties-3.1.12/lib/rails/initializable.rb:30:in `run'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#spreeTest/gems/railties-3.1.12/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#spreeTest/gems/railties-3.1.12/lib/rails/initializable.rb:54:in `each'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#spreeTest/gems/railties-3.1.12/lib/rails/initializable.rb:54:in `run_initializers'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#spreeTest/gems/railties-3.1.12/lib/rails/application.rb:96:in `initialize!'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#spreeTest/gems/railties-3.1.12/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/nish/repos/spree/voylla_website_production/config/environment.rb:7:in `<top (required)>'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#spreeTest/gems/polyglot-0.3.4/lib/polyglot.rb:65:in `require'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#spreeTest/gems/polyglot-0.3.4/lib/polyglot.rb:65:in `require'
from /home/nish/repos/spree/voylla_website_production/config.ru:3:in `block in <main>'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#spreeTest/gems/rack-1.3.10/lib/rack/builder.rb:51:in `instance_eval'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#spreeTest/gems/rack-1.3.10/lib/rack/builder.rb:51:in `initialize'
from /home/nish/repos/spree/voylla_website_production/config.ru:in `new'
from /home/nish/repos/spree/voylla_website_production/config.ru:in `<main>'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#spreeTest/gems/rack-1.3.10/lib/rack/builder.rb:40:in `eval'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#spreeTest/gems/rack-1.3.10/lib/rack/builder.rb:40:in `parse_file'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#spreeTest/gems/rack-1.3.10/lib/rack/server.rb:200:in `app'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#spreeTest/gems/railties-3.1.12/lib/rails/commands/server.rb:46:in `app'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#spreeTest/gems/rack-1.3.10/lib/rack/server.rb:304:in `wrapped_app'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#spreeTest/gems/rack-1.3.10/lib/rack/server.rb:254:in `start'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#spreeTest/gems/railties-3.1.12/lib/rails/commands/server.rb:70:in `start'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#spreeTest/gems/railties-3.1.12/lib/rails/commands.rb:54:in `block in <top (required)>'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#spreeTest/gems/railties-3.1.12/lib/rails/commands.rb:49:in `tap'
from /home/nish/.rvm/gems/ruby-1.9.2-p320#spreeTest/gems/railties-3.1.12/lib/rails/commands.rb:49:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
/config/initializers/product_review_ratings.rb
module Spree
module ProductReviewsRatings
class Config
include Singleton
include PreferenceAccess
class << self
def instance
return nil unless ActiveRecord::Base.connection.tables.include?('configurations')
ProductReviewsRatingsConfiguration.find_or_create_by_name("Default product reviews and ratings configuration")
end
end
end
end
end
I tried to google, but could not find anything

PreferenceAccess was removed from Spree 1.0.0 by this commit:
https://github.com/spree/spree/commit/a4a57db941eeb6329ac9a5de64f2175e33a56f95
You can add preference_access.rb to your application in order to bring that functionality back, however, this will most likely lead to something else breaking.
If possible, you may want to consider porting from SpreeProductReviewsRatings to the spree_reviews extension, which currently supports Spree 1.0 - 2.3.0.beta.

Related

Uninitialized constant ActionCable

I have found similar questions to this but none of the answers fixed the problem. I have an existing project I upgraded from v4.2.5 to 5.1.5. I wanted to add a chatroom using the Site Point tutorial but am having issues with ActionCable. Whenever I start up my server, it crashes with the following error:
/home/ubuntu/workspace/config/routes.rb:39:in `block in <top (required)>': uninitialized constant ActionCable (NameError)
from /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-4.2.5/lib/action_dispatch/routing/route_set.rb:434:in `instance_exec'
from /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-4.2.5/lib/action_dispatch/routing/route_set.rb:434:in `eval_block'
from /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-4.2.5/lib/action_dispatch/routing/route_set.rb:412:in `draw'
from /home/ubuntu/workspace/config/routes.rb:3:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/application/routes_reloader.rb:40:in `each'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-4.2.5/lib/active_support/file_update_checker.rb:75:in `execute'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/application/routes_reloader.rb:27:in `updater'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/initializable.rb:30:in `run'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/initializable.rb:55:in `block in run_initializers'
from /usr/local/rvm/rubies/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
from /usr/local/rvm/rubies/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /usr/local/rvm/rubies/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
from /usr/local/rvm/rubies/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
from /usr/local/rvm/rubies/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:347:in `each'
from /usr/local/rvm/rubies/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:347:in `call'
from /usr/local/rvm/rubies/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
from /usr/local/rvm/rubies/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
from /usr/local/rvm/rubies/ruby-2.3.4/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/application.rb:352:in `initialize!'
from /home/ubuntu/workspace/config/environment.rb:5:in `<top (required)>'
from /home/ubuntu/workspace/config.ru:3:in `require'
from /home/ubuntu/workspace/config.ru:3:in `block in <main>'
from /usr/local/rvm/gems/ruby-2.3.4/gems/rack-1.6.9/lib/rack/builder.rb:55:in `instance_eval'
from /usr/local/rvm/gems/ruby-2.3.4/gems/rack-1.6.9/lib/rack/builder.rb:55:in `initialize'
from /home/ubuntu/workspace/config.ru:in `new'
from /home/ubuntu/workspace/config.ru:in `<main>'
from /usr/local/rvm/gems/ruby-2.3.4/gems/rack-1.6.9/lib/rack/builder.rb:49:in `eval'
from /usr/local/rvm/gems/ruby-2.3.4/gems/rack-1.6.9/lib/rack/builder.rb:49:in `new_from_string'
from /usr/local/rvm/gems/ruby-2.3.4/gems/rack-1.6.9/lib/rack/builder.rb:40:in `parse_file'
from /usr/local/rvm/gems/ruby-2.3.4/gems/rack-1.6.9/lib/rack/server.rb:300:in `build_app_and_options_from_config'
from /usr/local/rvm/gems/ruby-2.3.4/gems/rack-1.6.9/lib/rack/server.rb:209:in `app'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/commands/server.rb:61:in `app'
from /usr/local/rvm/gems/ruby-2.3.4/gems/rack-1.6.9/lib/rack/server.rb:337:in `wrapped_app'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/commands/server.rb:139:in `log_to_stdout'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/commands/server.rb:78:in `start'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:80:in `block in server'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in `server'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I already manually created the following files to set up ActionCable:
# app/channels/application_cable/channel.rb
module ApplicationCable
class Channel < ActionCable::Channel::Base
end
end
and
# app/channels/application_cable/connection.rb
module ApplicationCable
class Connection < ActionCable::Connection::Base
identified_by :current_user
def connect
self.current_user = find_verified_user
logger.add_tags 'ActionCable', current_user.email
end
protected
def find_verified_user # this checks whether a user is authenticated with devise
if verified_user = env['warden'].user
verified_user
else
reject_unauthorized_connection
end
end
end
end
I have tried requiring both "action_cable" and "action_cable/engine" in the top of my config/application.rb, but it gives me the following errors:
# including "require 'action_cable/engine' "
/home/ubuntu/workspace/config/application.rb:4:in `require': cannot load such file -- action_cable/engine (LoadError)
from /home/ubuntu/workspace/config/application.rb:4:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:78:in `require'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in `server'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
and
# including "require 'action_cable' "
/home/ubuntu/workspace/config/application.rb:4:in `require': cannot load such file -- action_cable (LoadError)
from /home/ubuntu/workspace/config/application.rb:4:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:78:in `require'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in `server'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-4.2.5/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Because Rails 5 is meant to have actioncable pre-loaded, I have not included any gems for it.
My config/routes.rb is:
include SessionsHelper
Rails.application.routes.draw do
[...]
mount ActionCable.server => '/cable'
[...]
end
Issue is fixed- I don't know what happened but the app didn't upgrade properly and wasn't running as 5.1.5 after I tried upgrading it. I had to do it one more time and delete the following line from the config/application.rb : config.active_record.raise_in_transactional_callbacks = true in order to get it working.

`method_missing': undefined method `assets' for #<Rails::Engine::Configuration:0x9d6a6d8> (NoMethodError)

/usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/railtie/configuration.rb:85:in `method_missing': undefined method `assets' for #<Rails::Engine::Configuration:0x9d6a6d8> (NoMethodError)
from /usr/local/lib/ruby/gems/1.9.1/gems/font-awesome-sass-4.2.1/lib/font_awesome/sass/rails/engine.rb:10:in `block in <class:Engine>'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /var/www/device/config/environment.rb:5:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
from /var/www/device/config.ru:3:in `block in <main>'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
from /var/www/device/config.ru:in `new'
from /var/www/device/config.ru:in `<main>'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/commands/server.rb:46:in `app'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/commands/server.rb:70:in `start'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:55:in `block in <top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
getting this error when I use rails s. then after I update the rails using rake rails:update
it shows 'wrap-parameter' error.
Version 4.2.1 of font-awesome-sass has a bug I've found and reported here:
https://github.com/FortAwesome/font-awesome-sass/issues/58
Change your gem version to 4.2.0
That works for me.

Issue upgrading Rails 2.3 to 3.2.11 - undefined method `normalize_parameters' for class `ActionController::Request' (NameError)

Using the rails_upgrade plugin I successfully upgraded a 2.3 app to 3.0.6. My goal is to upgrade that 2.3 app to 3.2.11. Using the same process I'm able to get pretty far but I'm stuck on this one Active Support error. Any help would be appreciated -
/Users/TravisKs/.rvm/gems/ruby-1.9.3-p392#rabbitsferritsandgerbils.com/gems/activesupport-3.2.11/lib/active_support/core_ext/module/aliasing.rb:31:in `alias_method': undefined method `normalize_parameters' for class `ActionController::Request' (NameError)
from /Users/TravisKs/.rvm/gems/ruby-1.9.3-p392#rabbitsferritsandgerbils.com/gems/activesupport-3.2.11/lib/active_support/core_ext/module/aliasing.rb:31:in `alias_method_chain'
from /Users/TravisKs/Sites/rabbitsferritsandgerbils.com/config/initializers/patch_for_1.9.2.rb:37:in `<class:Request>'
from /Users/TravisKs/Sites/rabbitsferritsandgerbils.com/config/initializers/patch_for_1.9.2.rb:31:in `<module:ActionController>'
from /Users/TravisKs/Sites/rabbitsferritsandgerbils.com/config/initializers/patch_for_1.9.2.rb:30:in `<top (required)>'
from /Users/TravisKs/.rvm/gems/ruby-1.9.3-p392#rabbitsferritsandgerbils.com/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `load'
from /Users/TravisKs/.rvm/gems/ruby-1.9.3-p392#rabbitsferritsandgerbils.com/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `block in load'
from /Users/TravisKs/.rvm/gems/ruby-1.9.3-p392#rabbitsferritsandgerbils.com/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
from /Users/TravisKs/.rvm/gems/ruby-1.9.3-p392#rabbitsferritsandgerbils.com/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `load'
from /Users/TravisKs/.rvm/gems/ruby-1.9.3-p392#rabbitsferritsandgerbils.com/gems/railties-3.2.11/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>'
from /Users/TravisKs/.rvm/gems/ruby-1.9.3-p392#rabbitsferritsandgerbils.com/gems/railties-3.2.11/lib/rails/engine.rb:587:in `each'
from /Users/TravisKs/.rvm/gems/ruby-1.9.3-p392#rabbitsferritsandgerbils.com/gems/railties-3.2.11/lib/rails/engine.rb:587:in `block in <class:Engine>'
from /Users/TravisKs/.rvm/gems/ruby-1.9.3-p392#rabbitsferritsandgerbils.com/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/TravisKs/.rvm/gems/ruby-1.9.3-p392#rabbitsferritsandgerbils.com/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `run'
from /Users/TravisKs/.rvm/gems/ruby-1.9.3-p392#rabbitsferritsandgerbils.com/gems/railties-3.2.11/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/TravisKs/.rvm/gems/ruby-1.9.3-p392#rabbitsferritsandgerbils.com/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `each'
from /Users/TravisKs/.rvm/gems/ruby-1.9.3-p392#rabbitsferritsandgerbils.com/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/TravisKs/.rvm/gems/ruby-1.9.3-p392#rabbitsferritsandgerbils.com/gems/railties-3.2.11/lib/rails/application.rb:136:in `initialize!'
from /Users/TravisKs/.rvm/gems/ruby-1.9.3-p392#rabbitsferritsandgerbils.com/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/TravisKs/Sites/rabbitsferritsandgerbils.com/config/environment.rb:5:in `<top (required)>'
from /Users/TravisKs/Sites/rabbitsferritsandgerbils.com/config.ru:3:in `require'
from /Users/TravisKs/Sites/rabbitsferritsandgerbils.com/config.ru:3:in `block in <main>'
from /Users/TravisKs/.rvm/gems/ruby-1.9.3-p392#rabbitsferritsandgerbils.com/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
from /Users/TravisKs/.rvm/gems/ruby-1.9.3-p392#rabbitsferritsandgerbils.com/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
from /Users/TravisKs/Sites/rabbitsferritsandgerbils.com/config.ru:in `new'
from /Users/TravisKs/Sites/rabbitsferritsandgerbils.com/config.ru:in `<main>'
from /Users/TravisKs/.rvm/gems/ruby-1.9.3-p392#rabbitsferritsandgerbils.com/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
from /Users/TravisKs/.rvm/gems/ruby-1.9.3-p392#rabbitsferritsandgerbils.com/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
from /Users/TravisKs/.rvm/gems/ruby-1.9.3-p392#rabbitsferritsandgerbils.com/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
from /Users/TravisKs/.rvm/gems/ruby-1.9.3-p392#rabbitsferritsandgerbils.com/gems/railties-3.2.11/lib/rails/commands/server.rb:46:in `app'
from /Users/TravisKs/.rvm/gems/ruby-1.9.3-p392#rabbitsferritsandgerbils.com/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
from /Users/TravisKs/.rvm/gems/ruby-1.9.3-p392#rabbitsferritsandgerbils.com/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
from /Users/TravisKs/.rvm/gems/ruby-1.9.3-p392#rabbitsferritsandgerbils.com/gems/railties-3.2.11/lib/rails/commands/server.rb:70:in `start'
from /Users/TravisKs/.rvm/gems/ruby-1.9.3-p392#rabbitsferritsandgerbils.com/gems/railties-3.2.11/lib/rails/commands.rb:55:in `block in <top (required)>'
from /Users/TravisKs/.rvm/gems/ruby-1.9.3-p392#rabbitsferritsandgerbils.com/gems/railties-3.2.11/lib/rails/commands.rb:50:in `tap'
from /Users/TravisKs/.rvm/gems/ruby-1.9.3-p392#rabbitsferritsandgerbils.com/gems/railties-3.2.11/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Removing rabbitsferritsandgerbils.com/config/initializers/patch_for_1.9.2.rb seems to solve the problem for me. I did have to switch over to ruby 1.9.3.

Rails superclass mismatch error with two controllers

I have two controllers
one is defined as
class Admin::Businesses::DealsController < AdminController
it is located at app/controllers/admin/businesses/deals_controller.rb
the other
class Admin::DealsController < AdminController
is located at app/controllers/admin/deals_controller.rb
Everything works find in development env but When I push to heroku and the app loads in production env it gives me this error
/app/app/controllers/businesses/deals_controller.rb:1:in `<top (required)>': superclass mismatch for class DealsController (TypeError)
related lines from my routes.rb look like this
namespace 'admin' do
resources :deals do
end
resources :businesses do
resources :deals, module: "businesses"
end
end
Why is it giving me this error, due to same name of controllers ? or super class mismatch ? How can I fix this. I want two controllers for deals one under admin and the other under admin/businesses for business specific actions.
Here is the full stack trace when trying to run the app locally in prod env using
rails s -e production
/home/abid/Projects/vocallocal/app/controllers/admin/businesses/deals_controller.rb:1: warning: toplevel constant Businesses referenced by Admin::Businesses
Exiting
/home/abid/Projects/vocallocal/app/controllers/businesses/deals_controller.rb:1:in `<top (required)>': superclass mismatch for class DealsController (TypeError)
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `block in require'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:359:in `require_or_load'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:313:in `depend_on'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:225:in `require_dependency'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/engine.rb:439:in `block (2 levels) in eager_load!'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/engine.rb:438:in `each'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/engine.rb:438:in `block in eager_load!'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/engine.rb:436:in `each'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/engine.rb:436:in `eager_load!'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/application/finisher.rb:53:in `block in <module:Finisher>'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `run'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/initializable.rb:55:in `block in run_initializers'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `each'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/application.rb:136:in `initialize!'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/abid/Projects/vocallocal/config/environment.rb:5:in `<top (required)>'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `block in require'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
from /home/abid/Projects/vocallocal/config.ru:4:in `block in <main>'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
from /home/abid/Projects/vocallocal/config.ru:1:in `new'
from /home/abid/Projects/vocallocal/config.ru:1:in `<main>'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:40:in `eval'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:40:in `parse_file'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:200:in `app'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/commands/server.rb:46:in `app'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:301:in `wrapped_app'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:252:in `start'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/commands/server.rb:70:in `start'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/commands.rb:55:in `block in <top (required)>'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/commands.rb:50:in `tap'
from /usr/local/ruby/lib/ruby/gems/1.9.1/gems/railties-3.2.3/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Thanks
The problem is that your admin namespace in your routes is conflicting with your admin module in your class hierarchy. The details about why this is causing that specific error are complicated, but are explained in more detail at http://code.dblock.org/warning-toplevel-constant-xyz-referenced-adminxyz
The simplest solution is to rename one of your admins, probably the class name, to anything else.

Rails 3 uninitialized constant ... (NameError) in custom initializer

I'm trying to implement the contact form described here.
I get the following error when I run rails server:
/home/user/project/web/config/initializers/app_config.rb:11:in `<top (required)>': uninitialized constant RailsContactForm (NameError)
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/engine.rb:201:in `block (2 levels) in <class:Engine>'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/engine.rb:200:in `each'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/engine.rb:200:in `block in <class:Engine>'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/initializable.rb:25:in `instance_exec'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/initializable.rb:25:in `run'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/initializable.rb:50:in `block in run_initializers'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/initializable.rb:49:in `each'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/initializable.rb:49:in `run_initializers'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/application.rb:134:in `initialize!'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/application.rb:77:in `method_missing'
from /home/user/project/web/config/environment.rb:9:in `<top (required)>'
from /home/user/project/web/config.ru:3:in `block in <main>'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/builder.rb:46:in `instance_eval'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/builder.rb:46:in `initialize'
from /home/user/project/web/config.ru:1:in `new'
from /home/user/project/web/config.ru:1:in `<main>'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/builder.rb:35:in `eval'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/builder.rb:35:in `parse_file'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/server.rb:162:in `app'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/server.rb:253:in `wrapped_app'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/server.rb:204:in `start'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/commands/server.rb:65:in `start'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/commands.rb:30:in `block in <top (required)>'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/commands.rb:27:in `tap'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
/home/user/project/web/config/initializers/app_config.rb:11:in `<top (required)>': uninitialized constant RailsContactForm (NameError)
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/engine.rb:201:in `block (2 levels) in <class:Engine>'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/engine.rb:200:in `each'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/engine.rb:200:in `block in <class:Engine>'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/initializable.rb:25:in `instance_exec'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/initializable.rb:25:in `run'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/initializable.rb:50:in `block in run_initializers'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/initializable.rb:49:in `each'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/initializable.rb:49:in `run_initializers'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/application.rb:134:in `initialize!'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/application.rb:77:in `method_missing'
from /home/user/project/web/config/environment.rb:9:in `<top (required)>'
from /home/user/project/web/config.ru:3:in `block in <main>'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/builder.rb:46:in `instance_eval'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/builder.rb:46:in `initialize'
from /home/user/project/web/config.ru:1:in `new'
from /home/user/project/web/config.ru:1:in `<main>'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/builder.rb:35:in `eval'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/builder.rb:35:in `parse_file'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/server.rb:162:in `app'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/server.rb:253:in `wrapped_app'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/rack-1.2.3/lib/rack/server.rb:204:in `start'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/commands/server.rb:65:in `start'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/commands.rb:30:in `block in <top (required)>'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/commands.rb:27:in `tap'
from /home/user/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I can see he hasn't defined RailsContactForm anywhere else. I don't know enough rails to know whether this is intentional.
In this line: "RailsContactForm::Application.configure"
RailsContactForm is just the name he gave the application when he ran rails create. Just substitute that with your application name.
In that tutorial RailsContactForm is the name of the main app.
You'll need to change that to your app's name.

Resources