dimanche 28 juin 2015

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.

Passing variable to partial inside partial

In the view.html.erb:

<%= render @posts %>

In each _post.html.erb:

<%= render 'shared/block', blockedcallsign: post.callsign %>

In each _block.html.erb:

<%= button_to blockrelationships_path, class: 'btn btn-default btn-xs',
                        params: { 
                            blocker_callsign: @callsign, 
                            blocked_callsign: @blockedcallsign
                        },
                        remote: true do %>
<% end %>

Looking at the server logs, the blocked_callsign parameter is blank. I'm not passing the variable to the partial correctly. What's wrong with the code?

EDIT

With blockedcallsign instead of @blockedcallsign in _block.html.erb:

<%= button_to blockrelationships_path, class: 'btn btn-default btn-xs',
                        params: { 
                            blocker_callsign: @callsign, 
                            blocked_callsign: blockedcallsign
                        },
                        remote: true do %>
<% end %>

and the following in _post.html.erb:

<%= render 'shared/block', locals: { blockedcallsign: post.callsign } %>

I get the error: undefined local variable or method 'blockedcallsign'.

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
  }
)

Rails Bootstrap_form - Radio buttons not rendering label name in the show page

I have a form built with the bootstrap_form gem for ruby. within the form I have some radio buttons. the form renders perfectly with the correct labeling in the edit page of the form, however once I save the form and go to the "show" page to see the results, the inputs for the radio buttons are only showing the value of the radio button (which are numbers) and not the custom label name I have assigned. How can I make the custom label appear instead of the value in the show page?

Here is my code:

_form.html.erb:

  <%= f.form_group :gender, label: { text: "Gender" } do %>
    <%= f.radio_button :gender, 0, label: "Female", checked: true, inline: true  %>
    <%= f.radio_button :gender, 1, label: "Male", inline: true  %>
  <% end %>

  <%= f.form_group :nationality, label: { text: "Nationality" } do %>
    <%= f.radio_button :nationality, 0, label: "Kuwaiti", checked: true, inline: true  %>
    <%= f.radio_button :nationality, 1, label: "Non-Kuwaiti", inline: true  %>
  <% end %>

show.html.erb

    <p><strong>Full Name:</strong>&nbsp;&nbsp;<%= @profile.name %></p>
    <p><strong>Civil ID no:</strong>&nbsp;&nbsp;<%= @profile.civil %></p>
    <p><strong>Gender:</strong>&nbsp;&nbsp;<%= @profile.gender %></p>
    <p><strong>Nationality:</strong>&nbsp;&nbsp;<%= @profile.nationality %></p>
    <p><strong>Mobile no:</strong>&nbsp;&nbsp;<%= @profile.mobile %></p>
    <p><strong>Personal Email:</strong>&nbsp;&nbsp;<%= @profile.personal_email %></p>

Thanks for the help in advance!

Update:-

New form code:-

<%= f.form_group :gender, label: { text: "Gender" } do %>
    <%= f.radio_button :gender, 1  %>
    <%= f.label 'Female', inline: true, checked: true  %>
    <%= f.radio_button :gender, 0  %>
    <%= f.label 'Male', inline: true  %>
  <% end %>

Tried this suggestion but still getting the same problem, only the the radio buttons are no longer in line and have incorrect formatting.

What would be the best way to fetch information of Youtube result searched by a query?

This gem yourub is not compatible with fetching particular page of the result set(pagination)

Is there any other way to fetch data sets of the Youtube result searcged by a query?

I'd like to select the page number of the result set, and the maximum number of the records to show in one query.

Passing parameter to partial view - Rails 4/postgresql/json

I have a Deal model with a column/attribute called 'deal_info' which is a json column.

It looks like this for example

deal1.deal_info = [ { "modal_id": "4", "text1":"lorem" }, 
          { "modal_id": "6", "video2":"yonak" },
          { "modal_id": "9", "video2":"boom" } ] 
deal2.deal_info = [ { "modal_id": "10", "text1":"lorem" }, 
          { "modal_id": "11", "video2":"yonak" },
          { "modal_id": "11", "image4":"boom" } ]

On my view deal.html.erb, i have:

<%= for deal_nb in 0..@deal.number_of_deals do %>
  <div class="modal fade" id="myInfoModal<%= modal_nb %>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <!-- render the right modal type -->
    <%= render "layouts/modal_type_partials/mt#{ @deal.deal_info[deal_nb]['modal_id'] }", parameter_i_want_to_pass: deal_nb  %>
  </div>
<% end %>

Above, as you see above, I'd like to pass for each iteration of the loop inside parameter_i_want_to_pass the number of the iteration loop (2nd iteration would be parameter_i_want_to_pass= 2 for example).

On the partial I have:

<div class="modal-dialog">
  <div class="modal-content">
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
      <h4 class="modal-title" id="myModalLabel">this is mt4</h4>
    </div>
    <div class="modal-body">
      this is the text: <%= @deal.deal_info[parameter_i_want_to_pass]['text1'] %> 

    </div>
  </div>

I get the following error:

no implicit conversion of String into Integer (on line "this is the text: <%= @deal.deal_info[parameter_i_want_to_pass]")

Actually I even tried to detect more easily the bug by just passing a set number instead of the variable 'deal_nb'

<%= render "layouts/modal_type_partials/mt#{ @deal.deal_info[deal_nb]['modal_id'] }", parameter_i_want_to_pass: 2  %>

But I still get exactly the same error.