I ran the command rails server -p 8000 in the console to start my rails app, and I went to localhost:8000 in my browser, but I got an error saying something went wrong. I checked my console, and I saw this:
Started GET "/" for 127.0.0.1 at 2015-08-15 14:21:23 -0400
NameError (uninitialized constant ActiveModel::Validations::PresenceValidator):
activerecord (4.2.3) lib/active_record/validations/presence.rb:3:in `<module:Validations>'
activerecord (4.2.3) lib/active_record/validations/presence.rb:2:in `<module:ActiveRecord>'
activerecord (4.2.3) lib/active_record/validations/presence.rb:1:in `<top (required)>'
activerecord (4.2.3) lib/active_record/validations.rb:90:in `<top (required)>'
activerecord (4.2.3) lib/active_record/base.rb:294:in `<class:Base>'
activerecord (4.2.3) lib/active_record/base.rb:269:in `<module:ActiveRecord>'
activerecord (4.2.3) lib/active_record/base.rb:26:in `<top (required)>'
activerecord (4.2.3) lib/active_record/migration.rb:383:in `connection'
activerecord (4.2.3) lib/active_record/migration.rb:370:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.3) lib/active_support/callbacks.rb:84:in `run_callbacks'
actionpack (4.2.3) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.3) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.3) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.3) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.3) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.3) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.3) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.4) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.3) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
actionpack (4.2.3) lib/action_dispatch/middleware/static.rb:116:in `call'
rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
railties (4.2.3) lib/rails/engine.rb:518:in `call'
railties (4.2.3) lib/rails/application.rb:165:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
rack (1.6.4) lib/rack/content_length.rb:15:in `call'
rack (1.6.4) lib/rack/handler/webrick.rb:88:in `service'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
I updated all of my gems yesterday, including rails, so I'm thinking it has something to do with that. Is there something I did wrong when I updated all of the gems? I ran the command, and then I updated the Gemfile, but did I miss anything? (Let me know if you want me to put the Gemfile in here as well)
Here's my Gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin]
# Scans for vulnerabilities
gem 'brakeman', '~> 3.0.5'
gem 'dawnscanner', '~> 1.3.5'
You have to require the whole of active_model since it uses autoload to "lazily require" classes as needed.
The following code works fine:
require 'active_model'
class Person
include ActiveModel::Validations
end
I think I figured out the problem. I made a new app, without the two gems, and it worked. I went to my app and took out one of the gems (dawnscanner) and it worked.
Related
very new with ruby on rails. Apologize in advance for the somewhat obvious nature of this question.
I have a new rails app and I have included the shopify_app gem in my Gemfile. When trying to get the app up and running I am receiving the following error.
uninitialized constant ShopifyApp : in the following segment of code is where the error is occurring.
Rails.application.routes.draw do
root :to => 'home#index'
mount ShopifyApp::Engine, at: '/' # this is the line throwing the error
end
My question is , what could cause this error to be thrown? I believe this was installed when i ran bundle install ( with the shopify_app gem in the Gemfile) Please let me know if you need additional information. Any point in the right direction would be helpful for me. Thanks.
Here is the full trace associated with it as well.
config/routes.rb:3:in `block in <top (required)>'
actionpack (5.1.6) lib/action_dispatch/routing/route_set.rb:436:in `instance_exec'
actionpack (5.1.6) lib/action_dispatch/routing/route_set.rb:436:in `eval_block'
actionpack (5.1.6) lib/action_dispatch/routing/route_set.rb:418:in `draw'
config/routes.rb:1:in `<top (required)>'
railties (5.1.6) lib/rails/application/routes_reloader.rb:55:in `block in load_paths'
railties (5.1.6) lib/rails/application/routes_reloader.rb:55:in `each'
railties (5.1.6) lib/rails/application/routes_reloader.rb:55:in `load_paths'
railties (5.1.6) lib/rails/application/routes_reloader.rb:18:in `reload!'
railties (5.1.6) lib/rails/application/routes_reloader.rb:41:in `block in updater'
activesupport (5.1.6) lib/active_support/file_update_checker.rb:81:in `execute'
railties (5.1.6) lib/rails/application/routes_reloader.rb:25:in `execute'
railties (5.1.6) lib/rails/application/finisher.rb:141:in `block (2 levels) in <module:Finisher>'
activesupport (5.1.6) lib/active_support/callbacks.rb:413:in `instance_exec'
activesupport (5.1.6) lib/active_support/callbacks.rb:413:in `block in make_lambda'
activesupport (5.1.6) lib/active_support/callbacks.rb:197:in `block (2 levels) in halting'
activesupport (5.1.6) lib/active_support/callbacks.rb:601:in `block (2 levels) in default_terminator'
activesupport (5.1.6) lib/active_support/callbacks.rb:600:in `catch'
activesupport (5.1.6) lib/active_support/callbacks.rb:600:in `block in default_terminator'
activesupport (5.1.6) lib/active_support/callbacks.rb:198:in `block in halting'
activesupport (5.1.6) lib/active_support/callbacks.rb:507:in `block in invoke_before'
activesupport (5.1.6) lib/active_support/callbacks.rb:507:in `each'
activesupport (5.1.6) lib/active_support/callbacks.rb:507:in `invoke_before'
activesupport (5.1.6) lib/active_support/callbacks.rb:130:in `run_callbacks'
activesupport (5.1.6) lib/active_support/execution_wrapper.rb:108:in `run!'
activesupport (5.1.6) lib/active_support/reloader.rb:113:in `run!'
activesupport (5.1.6) lib/active_support/execution_wrapper.rb:70:in `block in run!'
activesupport (5.1.6) lib/active_support/execution_wrapper.rb:67:in `tap'
activesupport (5.1.6) lib/active_support/execution_wrapper.rb:67:in `run!'
activesupport (5.1.6) lib/active_support/reloader.rb:59:in `run!'
actionpack (5.1.6) lib/action_dispatch/middleware/executor.rb:10:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
web-console (3.6.0) lib/web_console/middleware.rb:137:in `call_app'
web-console (3.6.0) lib/web_console/middleware.rb:22:in `block in call'
web-console (3.6.0) lib/web_console/middleware.rb:20:in `catch'
web-console (3.6.0) lib/web_console/middleware.rb:20:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.1.6) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.1.6) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.1.6) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.1.6) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.1.6) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.1.6) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/request_id.rb:25:in `call'
rack (2.0.4) lib/rack/method_override.rb:22:in `call'
rack (2.0.4) lib/rack/runtime.rb:22:in `call'
activesupport (5.1.6) lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.6) lib/action_dispatch/middleware/static.rb:125:in `call'
rack (2.0.4) lib/rack/sendfile.rb:111:in `call'
railties (5.1.6) lib/rails/engine.rb:522:in `call'
puma (3.11.3) lib/puma/configuration.rb:225:in `call'
puma (3.11.3) lib/puma/server.rb:624:in `handle_request'
puma (3.11.3) lib/puma/server.rb:438:in `process_client'
puma (3.11.3) lib/puma/server.rb:302:in `block in run'
puma (3.11.3) lib/puma/thread_pool.rb:120:in `block in spawn_thread'
This error occurred while loading the following files:
Gemfile:
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.6'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use Puma as the app server
gem 'puma', '~> 3.7'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Shopify App Gem - should include Shopify API as well
gem 'shopify_app'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '~> 2.13'
gem 'selenium-webdriver'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console', '>= 3.3.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
It looks like you want to leave off at: '/'. You would only specify a NESTED route, one that wasn't / (root). You just want to mount in the root. As you can see here, it's going to create a bunch of routes for you.
https://github.com/Shopify/shopify_app#mounting-the-engine
Mounting the Engine will provide the basic routes to authenticating a shop with your application. By default it will provide:
Verb Route Action
GET '/login' Login
POST '/login' Login
GET '/auth/shopify/callback' Authenticate Callback
GET '/logout' Logout
POST '/webhooks/:type' Webhook Callback
I'm totally new to Ruby on Rails and I'm giving it a shot.
I'm saying in advance that I didn't find an answer to fit my problem nor here on StackOverflow nor on the internet (I tried lots of different things picked from SO and other web sites).
I'm following Rails for Zombies 2 on CodeSchool and I need to set up the enviroment in order to make things happen.
In order to make that, I'm following the setup phase from Michael Hartl's
Ruby on Rails Tutorial.
I followed every step but, when I would love to see: "hello, world!" in my browser I get:
ActiveRecord::ConnectionNotEstablished
No connection pool for ActiveRecord::Base
Full trace:
activerecord (4.2.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:566:in `retrieve_connection'
activerecord (4.2.2) lib/active_record/connection_handling.rb:113:in `retrieve_connection'
activerecord (4.2.2) lib/active_record/connection_handling.rb:87:in `connection'
activerecord (4.2.2) lib/active_record/query_cache.rb:51:in `restore_query_cache_settings'
activerecord (4.2.2) lib/active_record/query_cache.rb:43:in `rescue in call'
activerecord (4.2.2) lib/active_record/query_cache.rb:31:in `call'
activerecord (4.2.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:649:in `call'
actionpack (4.2.2) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.2) lib/active_support/callbacks.rb:88:in `call'
activesupport (4.2.2) lib/active_support/callbacks.rb:88:in `_run_callbacks'
activesupport (4.2.2) lib/active_support/callbacks.rb:776:in `_run_call_callbacks'
activesupport (4.2.2) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.2) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.2) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.2.2) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
web-console (2.0.0.beta3) lib/action_dispatch/debug_exceptions.rb:18:in `middleware_call'
web-console (2.0.0.beta3) lib/action_dispatch/debug_exceptions.rb:13:in `call'
actionpack (4.2.2) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.2) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.2) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.2) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.2) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.2) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.2) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.2) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.4) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.2) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
actionpack (4.2.2) lib/action_dispatch/middleware/static.rb:113:in `call'
rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
railties (4.2.2) lib/rails/engine.rb:518:in `call'
railties (4.2.2) lib/rails/application.rb:164:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
rack (1.6.4) lib/rack/content_length.rb:15:in `call'
rack (1.6.4) lib/rack/handler/webrick.rb:88:in `service'
Before getting this, I installed Rails, I entered my hello_app folder and used: Bundle Install and then I just used: Rails Server. I also deleted index.html as said in the guide.
My Gemfile:
source 'https://rubygems.org'
gem 'rails', '4.2.2'
gem 'sass-rails', '5.0.2'
gem 'uglifier', '2.5.3'
gem 'coffee-rails', '4.1.0'
gem 'jquery-rails', '>= 3.0.0'
gem 'turbolinks', '2.3.0'
gem 'jbuilder', '2.2.3'
gem 'sdoc', '0.4.0', group: :doc
group :development, :test do
gem 'sqlite3'
gem 'pry-byebug', platform: [:ruby_20]
gem 'web-console', '2.0.0.beta3'
gem 'spring', '1.1.3'
end
My Application Controller:
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
def hello
render text: "hello, world!"
end
end
My Routes:
HelloApp::Application.routes.draw do
root 'application#hello
end
My Database:
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000
I'm sorry if my problem is trivial and I'm also sorry for my awful english.
Thank you in advance!
BTW, have you run the bundle exec rake db:setup before starting the server? It looks like if your database just doesn't exist yet (you can check whether the db/development.sqlite3 file exists).
I solved it by myself. It was a problem cause by a broken Gemfile.
The right configuration that allowed me to let it work is:
Gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.2'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'debugger' anywhere in the code to stop execution and get a debugger console
gem 'debugger'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
This is sort of related to my other question listed here, but those solutions didn't work for me so I created a new rails app, but I got the same error, which I've listed below.
Started GET "/" for ::1 at 2015-08-29 16:26:01 -0400
NameError (uninitialized constant ActiveModel::Validations::PresenceValidator):
activerecord (4.2.4.rc1) lib/active_record/validations/presence.rb:3:in `<module:Validations>'
activerecord (4.2.4.rc1) lib/active_record/validations/presence.rb:2:in `<module:ActiveRecord>'
activerecord (4.2.4.rc1) lib/active_record/validations/presence.rb:1:in `<top (required)>'
activerecord (4.2.4.rc1) lib/active_record/validations.rb:90:in `<top (required)>'
activerecord (4.2.4.rc1) lib/active_record/base.rb:294:in `<class:Base>'
activerecord (4.2.4.rc1) lib/active_record/base.rb:269:in `<module:ActiveRecord>'
activerecord (4.2.4.rc1) lib/active_record/base.rb:26:in `<top (required)>'
activerecord (4.2.4.rc1) lib/active_record/migration.rb:383:in `connection'
activerecord (4.2.4.rc1) lib/active_record/migration.rb:370:in `call'
actionpack (4.2.4.rc1) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.4.rc1) lib/active_support/callbacks.rb:88:in `__run_callbacks__'
activesupport (4.2.4.rc1) lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
activesupport (4.2.4.rc1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.4.rc1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.4.rc1) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.2.4.rc1) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
actionpack (4.2.4.rc1) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
web-console (2.2.1) lib/web_console/middleware.rb:39:in `call'
actionpack (4.2.4.rc1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.4.rc1) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.4.rc1) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.4.rc1) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.4.rc1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.4.rc1) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.4.rc1) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.4.rc1) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.4) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.4.rc1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
actionpack (4.2.4.rc1) lib/action_dispatch/middleware/static.rb:116:in `call'
rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
railties (4.2.4.rc1) lib/rails/engine.rb:518:in `call'
railties (4.2.4.rc1) lib/rails/application.rb:165:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
rack (1.6.4) lib/rack/content_length.rb:15:in `call'
rack (1.6.4) lib/rack/handler/webrick.rb:88:in `service'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
c:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
And here is the Gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.4.rc1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
#
gem 'brakeman', '~> 3.0.5'
gem 'dawnscanner', '~> 1.3.5'
gem 'activemodel', '~> 4.2.3'
It's a last resort for me to regenerate all of the files from my website to a new app, but I'm not sure why it's happening with this new project. The only thing I've done is install two gems to help me with security, so maybe that's it but I'm not sure. Can anyone help?
I think I figured out the problem. I made a new app, without the two gems, and it worked. I went to my app and took out one of the gems (dawnscanner) and it worked.
I'm trying to set 7 directories, in 7 subdomains, using Rails + nginx + unicorn + MongoDB.
Actually, the subdomains are generated from root files by nginx and works perfectly, and I didn't use MongoDB yet.
Installations are freshly made, no pages created yet (and I also have tried with), and I still have 404 errors with an error in log.
Works if I create a html page in /public, of course.
Example:
I install one of them using rails new site1
in /var/www/site1
available on http://site1.mydomain.tld
It will display this error in /var/www/site1/log/production.log :
I, [2013-09-01T02:12:44.425694 #31368] INFO -- : Started GET "/" for XXX.XXX.XXX.XXX at 2013-09-01 02:12:44 +0200
F, [2013-09-01T02:12:44.426541 #31368] FATAL -- :
ActionController::RoutingError (No route matches [GET] "/"):
actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged'
activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged'
railties (4.0.0) lib/rails/rack/logger.rb:21:in `call'
actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
railties (4.0.0) lib/rails/engine.rb:511:in `call'
railties (4.0.0) lib/rails/application.rb:97:in `call'
unicorn (4.6.3) lib/unicorn/http_server.rb:552:in `process_client'
unicorn (4.6.3) lib/unicorn/http_server.rb:632:in `worker_loop'
unicorn (4.6.3) lib/unicorn/http_server.rb:500:in `spawn_missing_workers'
unicorn (4.6.3) lib/unicorn/http_server.rb:142:in `start'
unicorn (4.6.3) bin/unicorn:126:in `<top (required)>'
/usr/local/bin/unicorn:23:in `load'
/usr/local/bin/unicorn:23:in `<main>'
There's my Gemfile :
source 'https://rubygems.org'
gem 'rails', '4.0.0'
gem 'bson_ext'
# mongoDB tool
## gem 'mongoid', '~> 3.0.0'
## gem 'mongo', '~> 1.9.2'
#gem 'mongo_mapper'
gem 'sqlite3'
# Use unicorn as the app server
gem 'unicorn'
# CSS tool
gem 'sass-rails', '~> 4.0.0'
## JQUERY & javascript stuff
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'jbuilder', '~> 1.2'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
# Use debugger
# gem 'debugger', group: [:development, :test]
My config/unicorn.rb file :
root = "/var/www/site1"
working_directory root
pid "#{root}/tmp/pids/unicorn.pid"
stderr_path "#{root}/log/uni-err.log"
stdout_path "#{root}/log/uni-out.log"
listen "/tmp/site1-unicorn.test.sock"
worker_processes 2
timeout 30
Any help would be useful. Thanks!
Probably you have made a change to your route and did not restart. In order to view these changes, you must restart the service.
When I'm starting serven in production mode, i got this page:
"The page you were looking for doesn't exist. You may have mistyped the address or the page may have moved."
App works normally in development mode.
Here is my logs:
I, [2013-04-22T11:27:17.618777 #15685] INFO -- : Started GET "/" for 127.0.0.1 at 2013-04-22 11:27:17 +0400
F, [2013-04-22T11:27:17.620365 #15685] FATAL -- :
ActionController::RoutingError (No route matches [GET] "/"):
actionpack (4.0.0.beta1) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (4.0.0.beta1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.0.0.beta1) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.0.0.beta1) lib/rails/rack/logger.rb:21:in `block in call'
activesupport (4.0.0.beta1) lib/active_support/tagged_logging.rb:67:in `block in tagged'
activesupport (4.0.0.beta1) lib/active_support/tagged_logging.rb:25:in `tagged'
activesupport (4.0.0.beta1) lib/active_support/tagged_logging.rb:67:in `tagged'
railties (4.0.0.beta1) lib/rails/rack/logger.rb:21:in `call'
actionpack (4.0.0.beta1) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.0.0.beta1) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
actionpack (4.0.0.beta1) lib/action_dispatch/middleware/static.rb:64:in `call'
railties (4.0.0.beta1) lib/rails/engine.rb:510:in `call'
railties (4.0.0.beta1) lib/rails/application.rb:96:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
/home/u164/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/home/u164/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/home/u164/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
My Gemfile:
ruby "1.9.3"
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0.beta1'
gem 'execjs'
gem 'therubyracer'
#gem 'sqlite3'
gem 'pg'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 4.0.0.beta1'
gem 'coffee-rails', '~> 4.0.0.beta1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.0.1'
In Rails 4.0.0 when deploying to production, you will need to generate/create an index page which should be located in public/index.html.
I have successfully deployed on Amazon EC2 (AWS) using this fix.
For example:
$ rails generate controller welcome index