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.
Related
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.
My application runs normally on development environment but I am getting the following error when I try to run > rails server -e production
I have searched for this and I found answers about restarting unicorn but I don't have unicorn in my application, what can I do to fix it ?
/app/controllers/application_controller.rb:6:in `<class:ApplicationController>': uninitialized constant ApplicationController::CanCan (NameError)
from /home/dexter/Desktop item/Triton/app/controllers/application_controller.rb:1:in `<top (required)>'
from /var/lib/gems/1.9.1/gems/ckeditor-4.0.4/app/controllers/ckeditor/application_controller.rb:1:in `<top (required)>'
from /var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/engine.rb:439:in `block (2 levels) in eager_load!'
from /var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/engine.rb:438:in `each'
from /var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/engine.rb:438:in `block in eager_load!'
from /var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/engine.rb:436:in `each'
from /var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/engine.rb:436:in `eager_load!'
from /var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/application/railties.rb:8:in `each'
from /var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/application/railties.rb:8:in `all'
from /var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/engine.rb:434:in `eager_load!'
from /var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/application/finisher.rb:53:in `block in <module:Finisher>'
from /var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `instance_exec'
from /var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `run'
from /var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/initializable.rb:55:in `block in run_initializers'
from /var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `each'
from /var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `run_initializers'
from /var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/application.rb:136:in `initialize!'
from /var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/dexter/Desktop item/Triton/config/environment.rb:5:in `<top (required)>'
from /home/dexter/Desktop item/Triton/config.ru:3:in `block in <main>'
from /var/lib/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
from /var/lib/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
from /home/dexter/Desktop item/Triton/config.ru:in `new'
from /home/dexter/Desktop item/Triton/config.ru:in `<main>'
from /var/lib/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
from /var/lib/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
from /var/lib/gems/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
from /var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/commands/server.rb:46:in `app'
from /var/lib/gems/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
from /var/lib/gems/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
from /var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/commands/server.rb:70:in `start'
from /var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/commands.rb:55:in `block in <top (required)>'
from /var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/commands.rb:50:in `tap'
from /var/lib/gems/1.9.1/gems/railties-3.2.12/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
My application controller:
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :authenticate_user!
rescue_from CanCan::AccessDenied do |exception|
flash[:error] = exception.message
redirect_to root_path
end
private
def stored_location_for(resource_or_scope)
nil
end
def after_sign_in_path_for(resource_or_scope)
'/dashboard'
end
end
Gemfile > just posted the place of CanCan
group :assets do
gem 'cancan'
end
Remove cancan from your assets group in your Gemfile. The assets group are gems that are not to be used in production. Therefore when you run the application in production mode, gems in the assets block will be excluded.
I'm trying to run a ruby app i cloned from github on mylocalhost and get the following error when entering 'rails s' in the command:
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.rb:2:in `require': 126: The specified module could not be found. - C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/1.9/mysql2.so (LoadError)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/mysql2.rb:2:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2.rb:9:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2.rb:9:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:66:in `each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:66:in `block in require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:55:in `each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/runtime.rb:55:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler.rb:122:in `require'
from C:/Users/uklar/Documents/GitHub/Budget-Requests-New/config/application.rb:7:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.2/lib/rails/commands.rb:53:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.2/lib/rails/commands.rb:53:in `block in <top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.2/lib/rails/commands.rb:50:in `tap'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.2/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
C:\Users\uklar\Documents\GitHub\Budget-Requests-New [master +0 ~2 -0]>
Any ideas? Thanks!
Update: After downloading the libmysql.dll file and putting it in my ruby directory i get these messages:
=> Booting Thin
=> Rails 3.2.2 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.2/lib/action_dispatch/http/mime_type.rb:102: warning: already initialized constant JSON
Exiting
c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/client.rb:44:in `connect': Can't connect to MySQL server on 'localhost' (10061) (Mysql2::Error)
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/client.rb:44:in `initialize'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `new'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `mysql2_connection'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:277:in `new_connection'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:287:in `checkout_new_connection'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:235:in `block (2 levels) in checkout'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:230:in `loop'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:230:in `block in checkout'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:229:in `checkout'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:95:in `connection'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:374:in `retrieve_connection'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:168:in `retrieve_connection'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:142:in `connection'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.2/lib/active_record/model_schema.rb:308:in `clear_cache!'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.2/lib/active_record/railtie.rb:91:in `block (2 levels) in <class:Railtie>'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:418:in `_run__435324379__prepare__609126447__callbacks'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:405:in `__run_callback'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:81:in `run_callbacks'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.2/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.2/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.2/lib/rails/application/finisher.rb:47:in `block in <module:Finisher>'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.2/lib/rails/initializable.rb:30:in `instance_exec'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.2/lib/rails/initializable.rb:30:in `run'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.2/lib/rails/initializable.rb:55:in `block in run_initializers'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.2/lib/rails/initializable.rb:54:in `each'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.2/lib/rails/initializable.rb:54:in `run_initializers'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.2/lib/rails/application.rb:136:in `initialize!'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.2/lib/rails/railtie/configurable.rb:30:in `method_missing'
from c:/users/uklar/documents/github/budget-requests-new/config/environment.rb:5:in `<top (required)>'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `block in require'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:236:in `load_dependency'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-3.2.2/lib/active_support/dependencies.rb:251:in `require'
from c:/users/uklar/documents/github/budget-requests-new/config.ru:4:in `block in <main>'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
from c:/users/uklar/documents/github/budget-requests-new/config.ru:1:in `new'
from c:/users/uklar/documents/github/budget-requests-new/config.ru:1:in `<main>'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:40:in `eval'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:40:in `parse_file'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:200:in `app'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.2/lib/rails/commands/server.rb:46:in `app'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:301:in `wrapped_app'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:252:in `start'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.2/lib/rails/commands/server.rb:70:in `start'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.2/lib/rails/commands.rb:55:in `block in <top (required)>'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.2/lib/rails/commands.rb:50:in `tap'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.2/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Ok, so solution was:
Download libmysql.dll file and put it in ruby directory
open command prompt as administratoe and start the mysql server the following way:
C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld
I'm trying to run rails server and I'm seeing something like this:
C:\Users\Mama i Tata>cd c:/rails_project/my_app
c:\rails_project\my_app>rails s
=> Booting WEBrick
=> Rails 3.2.6 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
c:/rails_project/my_app/config/routes.rb:1:in `<top (required)>': uninitialized
constant SampleApp (NameError)
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/applic
ation/routes_reloader.rb:40:in `block in load_paths'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/applic
ation/routes_reloader.rb:40:in `each'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/applic
ation/routes_reloader.rb:40:in `load_paths'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/applic
ation/routes_reloader.rb:16:in `reload!'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/applic
ation/routes_reloader.rb:26:in `block in updater'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_
support/file_update_checker.rb:78:in `call'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activesupport-3.2.6/lib/active_
support/file_update_checker.rb:78:in `execute'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/applic
ation/routes_reloader.rb:27:in `updater'
from C:in `execute_if_updated'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/applic
ation/finisher.rb:66:in `block in <module:Finisher>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/initia
lizable.rb:30:in `instance_exec'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/initia
lizable.rb:30:in `run'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/initia
lizable.rb:55:in `block in run_initializers'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/initia
lizable.rb:54:in `each'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/initia
lizable.rb:54:in `run_initializers'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/applic
ation.rb:136:in `initialize!'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/railti
e/configurable.rb:30:in `method_missing'
from c:/rails_project/my_app/config/environment.rb:5:in `<top (required)
from c:/rails_project/my_app/config.ru:4:in `require'
from c:/rails_project/my_app/config.ru:4:in `block in <main>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:
51:in `instance_eval'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:
51:in `initialize'
from c:/rails_project/my_app/config.ru:1:in `new'
from c:/rails_project/my_app/config.ru:1:in `<main>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:
40:in `eval'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:
40:in `parse_file'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:2
00:in `app'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/comman
ds/server.rb:46:in `app'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:3
01:in `wrapped_app'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:2
52:in `start'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/comman
ds/server.rb:70:in `start'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/comman
ds.rb:55:in `block in <top (required)>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/comman
ds.rb:50:in `tap'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/comman
ds.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I'm using Ruby 1.9.3p194 (2012-04-20) [i386-mingw32].
Got any ideas?
As per the debug log and the Rails tutorial in chapter 5, what I understand is you tried to copy and paste the routes file:
SampleApp::Application.routes.draw do
get "static_pages/home"
.......
end
SampleApp here represents the name of the application and from your directory name I think it should be MyApp.
Your routes file should be:
MyApp::Application.routes.draw do
get "static_pages/home"
.......
end
That's just a first-look guess.
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.