Run code on the start of a rails server - ruby-on-rails

When the Ruby on Rails application starts I want it to run a block of code so that the database is filled with the required data. I've been searching for hours for a solution, none of the given solutions that I found worked. The following is the solution that I implemented.
In application.rb I placed the following block of code:
def fill_db
redirect_to url_for(:controller => :item, :action => :init)
self.delay(:run_at => 10.minute.from_now).fill_db
end
config.after_initialize do
redirect_to url_for(:controller => :item, :action => :init)
fill_db
end
I tried to implement dozens of other variants of this but none of them worked.
The error I get is this:
C:\xampp\htdocs\dev-ruby\untitled1>rails s
=> Booting WEBrick
=> Rails 4.2.6 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/railtie.rb:196:in `method_missing': undefined method `url_for' for Untitled1::Application:Class (NoMethodError)
from C:/xampp/htdocs/dev-ruby/untitled1/config/application.rb:40:in `block in <class:Application>'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:36:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:44:in `each'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/application/finisher.rb:62:in `block in <module:Finisher>'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `instance_exec'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `run'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/tsort.rb:345:in `each'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/tsort.rb:345:in `call'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/initializable.rb:54:in `run_initializers'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/application.rb:352:in `initialize!'
from C:/xampp/htdocs/dev-ruby/untitled1/config/environment.rb:5:in `<top (required)>'
from C:/xampp/htdocs/dev-ruby/untitled1/config.ru:3:in `require'
from C:/xampp/htdocs/dev-ruby/untitled1/config.ru:3:in `block in <main>'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
from C:/xampp/htdocs/dev-ruby/untitled1/config.ru:in `new'
from C:/xampp/htdocs/dev-ruby/untitled1/config.ru:in `<main>'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/server.rb:208:in `app'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/server.rb:61:in `app'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/server.rb:139:in `log_to_stdout'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/server.rb:78:in `start'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:80:in `block in server'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in `tap'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in `server'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
The same code works in a controller, but then it's not executed at the start of the rails server.

You cannot use redirect_to inside application.rb. This is part of the ActionController classes. Here are two things that you can do instead
1) Implement db:seed - there is a db/seed.rb that you can use to populate initial database values. After you deploy the code just run bin/rails db:seed to run this task that will fill out the database
or
2) Add before_action to applicationController
class ApplicationController < ActionController::Base
before_action :fill_db
end
To prevent from executing this method add conditional like unless populated?
Hope it helps

Related

Pagination in RoR is not working

I am working on a small ruby-on-rails program and stumbled upon on a pagination problem. After installing gems for pagination:
gem 'will_paginate', '3.0.7'
gem 'bootstrap-will_paginate', '0.0.10'
I changed the controller class to this:
def index
#allArticles = Article.paginate(page: params[:page], per_page: 5)
end
And changed the html.erb file to this:
<div align="center">
<%= will_paginate %>
</div>
<%= render 'article', obj: #allArticles %>
<div align="center">
<%= will_paginate %>
</div>
When I run the server locally it gives me this problem:
=> Booting Puma
=> Rails 5.0.0 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
Exiting
/home/inson/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0/lib/active_support/i18n_railtie.rb:45:in `map': undefined method `existent' for #<String:0x00000004c89818> (NoMethodError)
Did you mean? extend
from /home/inson/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0/lib/active_support/i18n_railtie.rb:45:in `block in initialize_i18n'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0/lib/active_support/i18n_railtie.rb:41:in `each'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0/lib/active_support/i18n_railtie.rb:41:in `initialize_i18n'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0/lib/active_support/i18n_railtie.rb:15:in `block in <class:Railtie>'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0/lib/active_support/lazy_load_hooks.rb:44:in `each'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/application/finisher.rb:65:in `block in <module:Finisher>'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/initializable.rb:30:in `instance_exec'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/initializable.rb:30:in `run'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/inson/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
from /home/inson/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /home/inson/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
from /home/inson/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
from /home/inson/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `each'
from /home/inson/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `call'
from /home/inson/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
from /home/inson/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
from /home/inson/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/initializable.rb:54:in `run_initializers'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/application.rb:352:in `initialize!'
from /home/inson/Desktop/Ruby/code/rails-projects/alpha-blog/config/environment.rb:5:in `<top (required)>'
from /home/inson/Desktop/Ruby/code/rails-projects/alpha-blog/config.ru:3:in `require_relative'
from /home/inson/Desktop/Ruby/code/rails-projects/alpha-blog/config.ru:3:in `block in <main>'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `instance_eval'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `initialize'
from /home/inson/Desktop/Ruby/code/rails-projects/alpha-blog/config.ru:in `new'
from /home/inson/Desktop/Ruby/code/rails-projects/alpha-blog/config.ru:in `<main>'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:49:in `eval'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:49:in `new_from_string'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:40:in `parse_file'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/server.rb:318:in `build_app_and_options_from_config'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/server.rb:218:in `app'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands/server.rb:59:in `app'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/server.rb:353:in `wrapped_app'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands/server.rb:124:in `log_to_stdout'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands/server.rb:77:in `start'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:90:in `block in server'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85:in `tap'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85:in `server'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0/lib/rails/commands.rb:18:in `<top (required)>'
from /home/inson/Desktop/Ruby/code/rails-projects/alpha-blog/bin/rails:9:in `require'
from /home/inson/Desktop/Ruby/code/rails-projects/alpha-blog/bin/rails:9:in `<top (required)>'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `load'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `call'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client/command.rb:7:in `call'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/client.rb:30:in `run'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/bin/spring:49:in `<top (required)>'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `load'
from /home/inson/.rvm/gems/ruby-2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `<top (required)>'
from /home/inson/Desktop/Ruby/code/rails-projects/alpha-blog/bin/spring:13:in `require'
from /home/inson/Desktop/Ruby/code/rails-projects/alpha-blog/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
I don`t know why it gives me a problem.
I was using the same plugin for a small API I was developing. Here's a small snippet on how I used will-paginate
# GET /posts
def index #posts = paginate Post.all, per_page: 10
render :json => {
:data => #posts,
:success => true
}
end
You can change global parameters in your configuration file. Or you can explicitly set certain parameters like I did when populating the variable.
Hope it helps!

I cannot understand this error message

When trying to boot my rails server i get an error:
home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/2.4.0/uri/rfc2396_parser.rb:305:in `escape': undefined method `gsub' for nil:NilClass (NoMethodError)
the full console log
=> Booting Puma
=> Rails 4.2.5 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
/home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/2.4.0/uri/rfc2396_parser.rb:305:in `escape': undefined method `gsub' for nil:NilClass (NoMethodError)
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/2.4.0/uri/common.rb:100:in `escape'
from /home/vladislav/Desktop/metartaf-develop/config/initializers/redis.rb:1:in `<top (required)>'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in `load'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in `block in load'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in `load'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/railties-4.2.5/lib/rails/engine.rb:652:in `block in load_config_initializer'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/activesupport-4.2.5/lib/active_support/notifications.rb:166:in `instrument'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/railties-4.2.5/lib/rails/engine.rb:651:in `load_config_initializer'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/railties-4.2.5/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/railties-4.2.5/lib/rails/engine.rb:615:in `each'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/railties-4.2.5/lib/rails/engine.rb:615:in `block in <class:Engine>'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/railties-4.2.5/lib/rails/initializable.rb:30:in `instance_exec'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/railties-4.2.5/lib/rails/initializable.rb:30:in `run'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/railties-4.2.5/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/2.4.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/2.4.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/railties-4.2.5/lib/rails/initializable.rb:44:in `each'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/railties-4.2.5/lib/rails/initializable.rb:44:in `tsort_each_child'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/2.4.0/tsort.rb:415:in `call'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/2.4.0/tsort.rb:415:in `each_strongly_connected_component_from'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/2.4.0/tsort.rb:347:in `each'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/2.4.0/tsort.rb:347:in `call'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/railties-4.2.5/lib/rails/initializable.rb:54:in `run_initializers'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/railties-4.2.5/lib/rails/application.rb:352:in `initialize!'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/railties-4.2.5/lib/rails/railtie.rb:194:in `public_send'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/railties-4.2.5/lib/rails/railtie.rb:194:in `method_missing'
from /home/vladislav/Desktop/metartaf-develop/config/environment.rb:5:in `<top (required)>'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `require'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `block in require'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `require'
from /home/vladislav/Desktop/metartaf-develop/config.ru:3:in `block in <main>'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
from /home/vladislav/Desktop/metartaf-develop/config.ru:in `new'
from /home/vladislav/Desktop/metartaf-develop/config.ru:in `<main>'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/rack-1.6.4/lib/rack/server.rb:208:in `app'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/railties-4.2.5/lib/rails/commands/server.rb:61:in `app'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/railties-4.2.5/lib/rails/commands/server.rb:139:in `log_to_stdout'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/railties-4.2.5/lib/rails/commands/server.rb:78:in `start'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:80:in `block in server'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:75:in `server'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /home/vladislav/.rbenv/versions/2.3.0-dev/lib/ruby/gems/2.4.0/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>'
This is not my project, so I don't know where the mistake is. Where do I have a mistake ?
#config/environment.rb
# Load the rails application.
require File.expand_path('../application', __FILE__)
# Initialize the rails application.
Metartaf::Application.initialize!
#config/initializers/redis.rb
REDISTOGO_URL="redis://user#localhost:6379/"
uri = URI.parse(URI.encode(ENV["REDISTOGO_URL"]))
$redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
You're using ENV["REDISTOGO_URL"] because the URL will be made available there in production (I guess you're using Heroku). That's fine, but then you're using the ruby constant REDISTOGO_URL for a local URL to use in development, which is not the same thing.
The error you're getting is because you're ignoring the REDISTOGO_URL constant, and still reading the value from ENV["REDISTOGO_URL"], which I guess is nil.
Try to replace:
REDISTOGO_URL="redis://user#localhost:6379/"
uri = URI.parse(URI.encode(ENV["REDISTOGO_URL"]))
with:
REDISTOGO_URL = ENV["REDISTOGO_URL"] || "redis://user#localhost:6379/"
uri = URI.parse(URI.encode(REDISTOGO_URL))

Gem errors when upgrading rails app from 3 to 4, unable to run rails s

I inherited a rails app that I believe was written in rails 3. I am now running rails 4.2.3. When I try to run the app locally (rails s) I get a host of errors related to active record and initializers. I have searched for these errors individually, but nothing I have done so far has worked.
I have added the protected attributes gem as mentioned here https://github.com/rails/protected_attributes/issues/5
I upgraded the gem file to use rails 4
I have upgraded the gems using bundle upgrade. No luck.
I have sent a message to the original dev and he has no idea why this is happening.
What do I need to do in order to make this app run locally without errors?
This is the errors I get when running rails s in terminal:
Astrids-MacBook-Air% rails s
=> Booting WEBrick
=> Rails 4.2.3 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
config.eager_load is set to nil. Please update your config/environments/*.rb files accordingly:
* development - set it to false
* test - set it to false (unless you use a tool that preloads your test environment)
* production - set it to true
Exiting
/Users/Astrid/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.3/lib/active_record/dynamic_matchers.rb:26:in `method_missing': undefined method `auto_explain_threshold_in_seconds=' for ActiveRecord::Base:Class (NoMethodError)
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.3/lib/active_record/railtie.rb:108:in `block (3 levels) in <class:Railtie>'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.3/lib/active_record/railtie.rb:107:in `each'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.3/lib/active_record/railtie.rb:107:in `block (2 levels) in <class:Railtie>'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:27:in `each'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.3/lib/active_record/railtie.rb:106:in `block in <class:Railtie>'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/initializable.rb:30:in `run'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/Astrid/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
from /Users/Astrid/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /Users/Astrid/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
from /Users/Astrid/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /Users/Astrid/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `each'
from /Users/Astrid/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `call'
from /Users/Astrid/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
from /Users/Astrid/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
from /Users/Astrid/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/application.rb:352:in `initialize!'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/railtie.rb:194:in `public_send'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/railtie.rb:194:in `method_missing'
from /Users/Astrid/Documents/Development/Handled/ticketsnap_server/config/environment.rb:5:in `<top (required)>'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `block in require'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
from /Users/Astrid/Documents/Development/Handled/ticketsnap_server/config.ru:3:in `block in <main>'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
from /Users/Astrid/Documents/Development/Handled/ticketsnap_server/config.ru:in `new'
from /Users/Astrid/Documents/Development/Handled/ticketsnap_server/config.ru:in `<main>'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/server.rb:208:in `app'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/commands/server.rb:61:in `app'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/commands/server.rb:139:in `log_to_stdout'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/commands/server.rb:78:in `start'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:80:in `block in server'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:75:in `server'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/commands.rb:17:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Remove auto_explain_threshold_in_seconds as said on release notes.

Issues with rails4 and mongoid on production mode

I am working with rails 4.2.x and Mongoid . I am getting the following error when I try to run server in production mode ,but it runs smoothly on development mode, not sure why I am getting this error . I tried precomipling asses but no luck.
=> Booting Thin
=> Rails 4.2.1 application starting in production on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
/home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/actionview-4.2.1/lib/action_view/helpers/debug_helper.rb:25:in `debug': wrong number of arguments (0 for 1) (ArgumentError)
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/sprockets-rails-2.2.4/lib/sprockets/railtie.rb:131:in `block (2 levels) in <class:Railtie>'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:27:in `each'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/sprockets-rails-2.2.4/lib/sprockets/railtie.rb:127:in `block in <class:Railtie>'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:36:in `call'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:44:in `each'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/railties-4.2.1/lib/rails/application/finisher.rb:62:in `block in <module:Finisher>'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `instance_exec'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/railties-4.2.1/lib/rails/initializable.rb:30:in `run'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/railties-4.2.1/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/ratnakar/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
from /home/ratnakar/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /home/ratnakar/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
from /home/ratnakar/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /home/ratnakar/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `each'
from /home/ratnakar/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `call'
from /home/ratnakar/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
from /home/ratnakar/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
from /home/ratnakar/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/railties-4.2.1/lib/rails/initializable.rb:54:in `run_initializers'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/railties-4.2.1/lib/rails/application.rb:352:in `initialize!'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/railties-4.2.1/lib/rails/railtie.rb:194:in `public_send'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/railties-4.2.1/lib/rails/railtie.rb:194:in `method_missing'
from /home/ratnakar/Projects/glimpse/Mar/23/glimpse/config/environment.rb:6:in `<top (required)>'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/backports-3.6.4/lib/backports/std_lib.rb:9:in `require'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/backports-3.6.4/lib/backports/std_lib.rb:9:in `require_with_backports'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `block in require'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
from /home/ratnakar/Projects/glimpse/Mar/23/glimpse/config.ru:3:in `block in <main>'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/rack-1.6.0/lib/rack/builder.rb:55:in `instance_eval'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/rack-1.6.0/lib/rack/builder.rb:55:in `initialize'
from /home/ratnakar/Projects/glimpse/Mar/23/glimpse/config.ru:in `new'
from /home/ratnakar/Projects/glimpse/Mar/23/glimpse/config.ru:in `<main>'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/rack-1.6.0/lib/rack/builder.rb:49:in `eval'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/rack-1.6.0/lib/rack/builder.rb:49:in `new_from_string'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/rack-1.6.0/lib/rack/builder.rb:40:in `parse_file'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/rack-1.6.0/lib/rack/server.rb:299:in `build_app_and_options_from_config'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/rack-1.6.0/lib/rack/server.rb:208:in `app'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/railties-4.2.1/lib/rails/commands/server.rb:61:in `app'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/rack-1.6.0/lib/rack/server.rb:336:in `wrapped_app'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/rack-1.6.0/lib/rack/server.rb:272:in `start'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/railties-4.2.1/lib/rails/commands/server.rb:80:in `start'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:80:in `block in server'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `server'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /home/ratnakar/.rvm/gems/ruby-2.1.5#glimpse/gems/railties-4.2.1/lib/rails/commands.rb:
The error has been rised from mailers where I used "include ActionView::Helpers" out side the email class.
I got it fixed by keeping include ActionView::Helpers inside the class, I am not sure about this order of inclusion. I changed like the following
include ActionView::Helpers
class EmailMailer < ActionMailer::Base
to
class EmailMailer < ActionMailer::Base
include ActionView::Helpers
Hope it helps for someone , I am still searching about the order of including modules in classes , once I found required information I will post here .

Try to print "Hello World" on webpage but something happened

I am a beginner in Ruby on Rails.
Today, I want to have my first try to print "Hello World" on webpage but something happened.
First of all,I create a "project" folder by "mkdir project" and then create new rails project in this folder by "rails new demo".
Next,I type "rails server" and website shows good.
Then,I type "rails generate controller welcome" and put this code
Demo::Application.routes.draw do
get "welcome/say_hello" => "welcome#say"
# ...
end
into config/routes.rb .
Then, I run "rails server" again and some problem happened like below.
C:\project\demo>rails s
=> Booting WEBrick
=> Rails 4.0.0 application starting in development on http://localhost:3000/
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load': C:/project/demo/config/routes.rb:59:
syntax error, unexpected keyword_end, expecting $end (SyntaxError)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport4.0.0/lib/active_support/dependencies.rb:222:in `block in load'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport4.0.0/lib/active_support/dependencies.rb:222:in `load'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:16:in `reload!'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-4.0.0/lib/active_support/file_update_checker.rb:75:in `call'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activesupport-4.0.0/lib/active_support/file_update_checker.rb:75:in `execute'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:27:in `updater'
from C:65535:in `execute_if_updated'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/tsort.rb:150:in `block intsort_each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/tsort.rb:183:in `block (2 levels)in each_strongly_connected_component'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/tsort.rb:219:in `each_strongly_connected_component_from'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/tsort.rb:182:in `block in each_strongly_connected_component'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/tsort.rb:180:in `each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/tsort.rb:180:in `each_strongly_connected_component'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/tsort.rb:148:in `tsort_each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
from C:/project/demo/config/environment.rb:5:in `<top (required)>'
from C:/project/demo/config.ru:3:in `require'
from C:/project/demo/config.ru:3:in `block in <main>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
from C:/project/demo/config.ru:in `new'
from C:/project/demo/config.ru:in `<main>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/commands/server.rb:48:in `app'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/commands/server.rb:75:in `start'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/commands.rb:78:in `block in <top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
Is anyone know what happened??
This is my routes filr as below:
Demo::Application.routes.draw do
get "welcome/say_hello" => "welcome#say"
# ...
end
You have a syntax error in your routes file on line 59. You probably forgot to add a do keyword to a block, or forgot to close a block by using an end keyword.
Show us your routes file in order to debug the problem more accurately.
See this line in the stack trace:
load': C:/project/demo/config/routes.rb:59: syntax error, unexpected keyword_end, expecting $end

Resources