dimanche 28 juin 2015

syntax error, unexpected tINTEGER, expecting '('

My code is

 for i in 0..array_dif.count-1
   a = array_dif[i] - array_dif[0]
   b = array_dif[array_dif.count-1] - array_dif[0]
   norm = a.0/b
   array_norm[i] = norm
 end

And i'm getting the following error:

rb:135: no .<digit> floating literal anymore; put 0 before dot (SyntaxError)
    norm = a.0/b
             ^
C:/piegas/config/initializers/backtrace_silencers.rb:135: syntax error, unexpected tINTEGER, expecting '('
    norm = a.0/b
              ^

I don't know whats wrong with it

1;2c OSX mystery: Sometimes 1;2c appears on the next input line

EDIT: Simplified version (skips fuzzing the console for other issues):

pzrq@icebox:~$ python
Python 2.7.6 (default, Sep  9 2014, 15:04:36) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> for b in [89,90]: print chr(b)+chr(27)
... 
Y

>> 1;2c

EDIT2: Reproduced in Ruby:

Last login: Mon Jun 29 00:43:22 on ttys000
pzrq@icebox:~$ irb
2.1.1 :001 > for b in [89,90]
2.1.1 :002?>   putc b
2.1.1 :003?>   putc 27
2.1.1 :004?>   end
Y=> [89, 90] 
2.1.1 :005 > 1;2c


Original:

Reproducible (most of the time) enigma I've never seen before:

# Setup
$ mkvirtualenv pycrypto_test
$ pip install pycrypto
$ python

# Script 1
>>> from Crypto import Random
>>> for _ in range(10**3): print(Random.get_random_bytes(130))

# On the next input line, get 1;2c printed 0-10 times
# Just OSX Python 2.7.6, does not affect Homebrew Python 3.4.2
# Happens with or without ipython
>>> 1;2c1;2c1;2c

Have also seen it change the ipython shell prompt twice from normal square brackets (but can't reproduce reliably) to:

In é1ê: 

I'd guess the first script is printing ASCII control characters under Python2, but in Python3 it's just printing byte strings.

# Script 2: Reproduced under (OSX) `brew install python3` v3.4.2 with
>>> for _ in range(10**3):
...   for b in Random.get_random_bytes(130):
...     print(chr(b))

# Lots of output
>>> 1;2c1;2c

What ASCII or other control characters might cause this? Or is there another explanation?

at=error code=H10 desc="App crashed" method=GET path="/" dyno= connect= service= status=503 bytes [on hold]

Thanks for helping! I have been working right with my app in ruby on rails hosted on heroku. Recently i made the last deploy and then in heroku i have this error:

2015-06-23T14:41:26.023607+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=lapapaya.org request_id=6d86d516-71cc-4892-a668-4df4a0326e30 fwd="186.27.168.226" dyno= connect= service= status=503 bytes=

I can't understand what is the origin of the error. It seems it have relation with dyno, but don't understand. Any of you have something similar?

Failure/Error: visit movie_url(movie) ActionView::Template::Error: wrong number of arguments (3 for 0..1)

This question sounds very similar to those that have already been asked and answered thought I can't seem to figure it out.

I have the following error message that makes my spec test fail.

Failures:

  1) Navigating movies allows navigation from the detail page to the listing page
     Failure/Error: visit movie_url(movie)
     ActionView::Template::Error:
       wrong number of arguments (3 for 0..1)
     # ./app/views/movies/show.html.erb:24:in `_app_views_movies_show_html_erb__1138068182152565203_70152862507580'
     # ./spec/navigate_movies_spec.rb:12:in `block (2 levels) in <top (required)>'

Finished in 0.20747 seconds
1 example, 1 failure

Failed examples:

rspec ./spec/navigate_movies_spec.rb:5 # Navigating movies allows navigation from the detail page to the listing page

Randomized with seed 14064

My actual spec test looks like this:

require 'spec_helper'
include Rails.application.routes.url_helpers

  describe "Navigating movies" do
    it "allows navigation from the detail page to the listing page" do
    ...
    visit movie_url(movie)

    click_link "All Movies"

    expect(current_path).to eq(movies_path)
  end
end

My show page: <%= link_to "All Movies", movies_path %> Edited:

rake routes
Prefix Verb URI Pattern           Controller#Action
movies GET  /movies(.:format)     movies#index
 movie GET  /movies/:id(.:format) movies#show

Edit #3

bundle exec rspec -b
FF.

Failures:

  1) Viewing an individual movie shows the movie's details
     Failure/Error: visit movie_url(movie)
     ActionView::Template::Error:
       wrong number of arguments (3 for 0..1)
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/url_for.rb:150:in `url_for'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:280:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:223:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:345:in `block (2 levels) in define_url_helper'
     # ./app/views/movies/show.html.erb:23:in `_app_views_movies_show_html_erb__342552887677354596_70168586387480'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/template.rb:145:in `block in render'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:166:in `instrument'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/template.rb:333:in `instrument'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/template.rb:143:in `render'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/template_renderer.rb:54:in `block (2 levels) in render_template'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:164:in `block in instrument'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:164:in `instrument'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/abstract_renderer.rb:39:in `instrument'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/template_renderer.rb:53:in `block in render_template'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/template_renderer.rb:61:in `render_with_layout'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/template_renderer.rb:52:in `render_template'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/template_renderer.rb:14:in `render'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/renderer.rb:42:in `render_template'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/renderer.rb:23:in `render'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/rendering.rb:100:in `_render_template'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/streaming.rb:217:in `_render_template'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/rendering.rb:83:in `render_to_body'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/rendering.rb:32:in `render_to_body'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/renderers.rb:37:in `render_to_body'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/abstract_controller/rendering.rb:25:in `render'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/rendering.rb:16:in `render'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
     # /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/benchmark.rb:296:in `realtime'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/core_ext/benchmark.rb:12:in `ms'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/instrumentation.rb:44:in `block in render'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime'
     # /Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.1/lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/instrumentation.rb:43:in `render'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/implicit_render.rb:10:in `default_render'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/implicit_render.rb:5:in `send_action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/abstract_controller/base.rb:198:in `process_action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/rendering.rb:10:in `process_action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:117:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:117:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:505:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:505:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:92:in `_run_callbacks'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:776:in `_run_process_action_callbacks'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/abstract_controller/callbacks.rb:19:in `process_action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/rescue.rb:29:in `process_action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:164:in `block in instrument'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:164:in `instrument'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
     # /Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.1/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/abstract_controller/base.rb:137:in `process'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/rendering.rb:30:in `process'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal.rb:196:in `dispatch'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal.rb:237:in `block in action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:74:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:74:in `dispatch'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:43:in `serve'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/journey/router.rb:43:in `block in serve'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/journey/router.rb:30:in `each'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/journey/router.rb:30:in `serve'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:819:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/etag.rb:24:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/conditionalget.rb:25:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/head.rb:13:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/params_parser.rb:27:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/flash.rb:260:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:225:in `context'
     # /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:220:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/cookies.rb:560:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.1/lib/active_record/query_cache.rb:36:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:649:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:88:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:88:in `_run_callbacks'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:776:in `_run_call_callbacks'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/web-console-2.1.3/lib/web_console/middleware.rb:37:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/railties-4.2.1/lib/rails/rack/logger.rb:38:in `call_app'
     # /Library/Ruby/Gems/2.0.0/gems/railties-4.2.1/lib/rails/rack/logger.rb:20:in `block in call'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/tagged_logging.rb:68:in `block in tagged'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/tagged_logging.rb:26:in `tagged'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/tagged_logging.rb:68:in `tagged'
     # /Library/Ruby/Gems/2.0.0/gems/railties-4.2.1/lib/rails/rack/logger.rb:20:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/request_id.rb:21:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/methodoverride.rb:22:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/runtime.rb:18:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/lock.rb:17:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/static.rb:113:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/sendfile.rb:113:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/railties-4.2.1/lib/rails/engine.rb:518:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/railties-4.2.1/lib/rails/application.rb:164:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/urlmap.rb:66:in `block in call'
     # /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/urlmap.rb:50:in `each'
     # /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/urlmap.rb:50:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/rack-test-0.6.3/lib/rack/mock_session.rb:30:in `request'
     # /Library/Ruby/Gems/2.0.0/gems/rack-test-0.6.3/lib/rack/test.rb:244:in `process_request'
     # /Library/Ruby/Gems/2.0.0/gems/rack-test-0.6.3/lib/rack/test.rb:58:in `get'
     # /Library/Ruby/Gems/2.0.0/gems/capybara-2.1.0/lib/capybara/rack_test/browser.rb:59:in `process'
     # /Library/Ruby/Gems/2.0.0/gems/capybara-2.1.0/lib/capybara/rack_test/browser.rb:35:in `process_and_follow_redirects'
     # /Library/Ruby/Gems/2.0.0/gems/capybara-2.1.0/lib/capybara/rack_test/browser.rb:21:in `visit'
     # /Library/Ruby/Gems/2.0.0/gems/capybara-2.1.0/lib/capybara/rack_test/driver.rb:42:in `visit'
     # /Library/Ruby/Gems/2.0.0/gems/capybara-2.1.0/lib/capybara/session.rb:193:in `visit'
     # /Library/Ruby/Gems/2.0.0/gems/capybara-2.1.0/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>'
     # ./spec/show_movie_spec.rb:9:in `block (2 levels) in <top (required)>'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/example.rb:114:in `instance_eval'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/example.rb:114:in `block in run'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/example.rb:179:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/example.rb:179:in `run'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/extensions/instance_eval_with_args.rb:16:in `instance_exec'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/extensions/instance_eval_with_args.rb:16:in `instance_eval_with_args'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/example.rb:247:in `instance_eval_with_args'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/hooks.rb:87:in `block (2 levels) in run'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/hooks.rb:89:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/hooks.rb:89:in `run'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/hooks.rb:418:in `run_hook'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:329:in `run_around_each_hooks'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/example.rb:256:in `with_around_each_hooks'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/example.rb:111:in `run'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:390:in `block in run_examples'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:386:in `map'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:386:in `run_examples'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:371:in `run'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:28:in `block (2 levels) in run'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:28:in `map'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:28:in `block in run'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/reporter.rb:34:in `report'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:25:in `run'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:80:in `run'
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:17:in `block in autorun'

  2) Navigating movies allows navigation from the detail page to the listing page
     Failure/Error: visit movie_url(movie.to_param)
     ActionView::Template::Error:
       wrong number of arguments (3 for 0..1)
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/url_for.rb:150:in `url_for'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:280:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:223:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_dispatch/routing/route_set.rb:345:in `block (2 levels) in define_url_helper'
     # ./app/views/movies/show.html.erb:23:in `_app_views_movies_show_html_erb__342552887677354596_70168586387480'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/template.rb:145:in `block in render'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:166:in `instrument'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/template.rb:333:in `instrument'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/template.rb:143:in `render'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/template_renderer.rb:54:in `block (2 levels) in render_template'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:164:in `block in instrument'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:164:in `instrument'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/abstract_renderer.rb:39:in `instrument'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/template_renderer.rb:53:in `block in render_template'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/template_renderer.rb:61:in `render_with_layout'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/template_renderer.rb:52:in `render_template'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/template_renderer.rb:14:in `render'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/renderer.rb:42:in `render_template'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/renderer/renderer.rb:23:in `render'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/rendering.rb:100:in `_render_template'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/streaming.rb:217:in `_render_template'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/rendering.rb:83:in `render_to_body'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/rendering.rb:32:in `render_to_body'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/renderers.rb:37:in `render_to_body'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/abstract_controller/rendering.rb:25:in `render'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/rendering.rb:16:in `render'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
     # /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/benchmark.rb:296:in `realtime'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/core_ext/benchmark.rb:12:in `ms'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/instrumentation.rb:44:in `block in render'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime'
     # /Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.1/lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/instrumentation.rb:43:in `render'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/implicit_render.rb:10:in `default_render'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/implicit_render.rb:5:in `send_action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/abstract_controller/base.rb:198:in `process_action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/rendering.rb:10:in `process_action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:117:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:117:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:505:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:505:in `call'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:92:in `_run_callbacks'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:776:in `_run_process_action_callbacks'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/abstract_controller/callbacks.rb:19:in `process_action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/rescue.rb:29:in `process_action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:164:in `block in instrument'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
     # /Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.1/lib/active_support/notifications.rb:164:in `instrument'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
     # /Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.1/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/abstract_controller/base.rb:137:in `process'
     # /Library/Ruby/Gems/2.0.0/gems/actionview-4.2.1/lib/action_view/rendering.rb:30:in `process'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-4.2.1/lib/action_controller/metal.rb:196:in `dispatch'
     # /Library/Ruby/Gems/2.0.0/gems/actionpack-
     # /Library/Ruby/Gems/2.0.0/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:17:in `block in autorun'

Finished in 0.84651 seconds
3 examples, 2 failures

Failed examples:

rspec ./spec/show_movie_spec.rb:6 # Viewing an individual movie shows the movie's details
rspec ./spec/navigate_movies_spec.rb:5 # Navigating movies allows navigation from the detail page to the listing page

rake db:seed -> Mongoid::Errors::NoSessionConfig:

I am building an application in ROR using SQLite.

In the project I include a gem which has run time dependency in Mongoid.

However for my case, I do not use mongoid or any mongodb.

When I am running rake db:seed which I use to fill the fields in my sql database I receive the specific error:

rake aborted!

Mongoid::Errors::NoSessionConfig: Problem: No configuration could be found for a session named 'default'. Summary: When attempting to create the new session, Mongoid could not find a session configuration for the name: 'default'. This is necessary in order to know the host, port, and options needed to connect. Resolution: Double check your mongoid.yml to make sure under the sessions key that a configuration exists for 'default'. If you have set the configuration programatically, ensure that 'default' exists in the configuration hash.

Updating Hash value in Ruby

What i'd like to do is push a bunch of user inputted strings, separated by their spaces to Hash Keys and assign each of those Keys a numerical value from 0 upwards in their order of input. For example;

User input: "a s d f b"

Result:

a => 0
b => 1
c => 2
d => 3
f => 4
b => 5

But my code is only outputting 0 with no increment, please see my code below;

puts "Please enter data:"
text = gets.chomp
words = text.split(" ")
    frequencies = Hash.new(0)

words.each do |k|
    frequencies[k] += 1
end

frequencies.each do |x,y|
    puts x + " " + y.to_s
end

Can anyone see what's wrong with the code above?

Why this won't fetch particular page of the result set?

Following youtube's official API document, I made this code below.
It shows fine if I take off

:pageToken => 5

How can I fetch particular page of the result sets?(I mean pagination here)

Original Code

@search_response = client.execute!(
  :api_method => youtube.search.list,
  :parameters => {
    :part => 'snippet',
    :q => 'cat',
    :maxResults => 10,
    :order => 'date',
    :pageToken => 5
  }
)