I'm following the rails tutorial # http://railstutorial.org
On chapter 11, I'm having issues with showing microposts from users.
Based on the tutorial, the RSPEC test should pass. However, it fails
1) UsersController GET 'show' should show the user's microposts
Failure/Error: get :show, :id => #user
undefined method `model_name' for NilClass:Class
# ./app/views/users/show.html.erb:10:in `_app_views_users_show_html_erb__49
# ./spec/controllers/users_controller_spec.rb:71
When I try to access a user's page which has microposts associated with it, I get an exception :
NoMethodError in Users#show
Showing C:/Documents and Settings/XXXXX/workspace/sample_app/app/views/users/show.html.erb where line #10 raised:
undefined method `model_name' for NilClass:Class
Extracted source (around line #10):
7: </h1>
8: <% unless #user.microposts.empty? %>
9: <table class="microposts" summary="User microposts">
10: <%= render #microposts %>
11: </table>
12: <%= will_paginate #microposts %>
13: <% end %>
Rails.root: C:/Documents and Settings/XXXXX/workspace/sample_app
Application Trace | Framework Trace | Full Trace
actionpack (3.0.0) lib/action_view/render/partials.rb:319:in `partial_path'
actionpack (3.0.0) lib/action_view/render/partials.rb:207:in `setup'
actionpack (3.0.0) lib/action_view/render/partials.rb:186:in `initialize'
actionpack (3.0.0) lib/action_view/render/partials.rb:331:in `new'
actionpack (3.0.0) lib/action_view/render/partials.rb:331:in `_render_partial'
actionpack (3.0.0) lib/action_view/render/rendering.rb:31:in `render'
app/views/users/show.html.erb:10:in `_app_views_users_show_html_erb__49899798_36559632_0'
actionpack (3.0.0) lib/action_view/template.rb:135:in `send'
actionpack (3.0.0) lib/action_view/template.rb:135:in `render'
activesupport (3.0.0) lib/active_support/notifications.rb:54:in `instrument'
actionpack (3.0.0) lib/action_view/template.rb:127:in `render'
actionpack (3.0.0) lib/action_view/render/rendering.rb:59:in `_render_template'
activesupport (3.0.0) lib/active_support/notifications.rb:52:in `instrument'
activesupport (3.0.0) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.0) lib/active_support/notifications.rb:52:in `instrument'
actionpack (3.0.0) lib/action_view/render/rendering.rb:56:in `_render_template'
actionpack (3.0.0) lib/action_view/render/rendering.rb:26:in `render'
actionpack (3.0.0) lib/abstract_controller/rendering.rb:114:in `_render_template'
actionpack (3.0.0) lib/abstract_controller/rendering.rb:108:in `render_to_body'
actionpack (3.0.0) lib/action_controller/metal/renderers.rb:47:in `render_to_body'
actionpack (3.0.0) lib/action_controller/metal/compatibility.rb:55:in `render_to_body'
actionpack (3.0.0) lib/abstract_controller/rendering.rb:101:in `render_to_string'
actionpack (3.0.0) lib/abstract_controller/rendering.rb:92:in `render'
actionpack (3.0.0) lib/action_controller/metal/rendering.rb:17:in `render'
actionpack (3.0.0) lib/action_controller/metal/instrumentation.rb:40:in `render'
activesupport (3.0.0) lib/active_support/core_ext/benchmark.rb:5:in `ms'
c:/Ruby187/lib/ruby/1.8/benchmark.rb:308:in `realtime'
activesupport (3.0.0) lib/active_support/core_ext/benchmark.rb:5:in `ms'
actionpack (3.0.0) lib/action_controller/metal/instrumentation.rb:40:in `render'
actionpack (3.0.0) lib/action_controller/metal/instrumentation.rb:78:in `cleanup_view_runtime'
activerecord (3.0.0) lib/active_record/railties/controller_runtime.rb:15:in `cleanup_view_runtime'
actionpack (3.0.0) lib/action_controller/metal/instrumentation.rb:39:in `render'
actionpack (3.0.0) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (3.0.0) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (3.0.0) lib/abstract_controller/base.rb:150:in `process_action'
actionpack (3.0.0) lib/action_controller/metal/rendering.rb:11:in `process_action'
actionpack (3.0.0) lib/abstract_controller/callbacks.rb:18:in `process_action'
activesupport (3.0.0) lib/active_support/callbacks.rb:435:in `_run__434435962__process_action__453433196__callbacks'
activesupport (3.0.0) lib/active_support/callbacks.rb:409:in `send'
activesupport (3.0.0) lib/active_support/callbacks.rb:409:in `_run_process_action_callbacks'
activesupport (3.0.0) lib/active_support/callbacks.rb:93:in `send'
activesupport (3.0.0) lib/active_support/callbacks.rb:93:in `run_callbacks'
actionpack (3.0.0) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.0.0) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
activesupport (3.0.0) lib/active_support/notifications.rb:52:in `instrument'
activesupport (3.0.0) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.0) lib/active_support/notifications.rb:52:in `instrument'
actionpack (3.0.0) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.0.0) lib/action_controller/metal/rescue.rb:17:in `process_action'
actionpack (3.0.0) lib/abstract_controller/base.rb:119:in `process'
actionpack (3.0.0) lib/abstract_controller/rendering.rb:40:in `process'
actionpack (3.0.0) lib/action_controller/metal.rb:133:in `dispatch'
actionpack (3.0.0) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.0.0) lib/action_controller/metal.rb:173
actionpack (3.0.0) lib/action_dispatch/routing/route_set.rb:62:in `call'
actionpack (3.0.0) lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
actionpack (3.0.0) lib/action_dispatch/routing/route_set.rb:27:in `call'
rack-mount (0.6.13) lib/rack/mount/route_set.rb:148:in `call'
rack-mount (0.6.13) lib/rack/mount/code_generation.rb:93:in `recognize'
rack-mount (0.6.13) lib/rack/mount/code_generation.rb:82:in `optimized_each'
rack-mount (0.6.13) lib/rack/mount/code_generation.rb:92:in `recognize'
rack-mount (0.6.13) lib/rack/mount/route_set.rb:139:in `call'
actionpack (3.0.0) lib/action_dispatch/routing/route_set.rb:492:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/head.rb:14:in `call'
rack (1.2.1) lib/rack/methodoverride.rb:24:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/flash.rb:182:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/cookies.rb:287:in `call'
activerecord (3.0.0) lib/active_record/query_cache.rb:32:in `call'
activerecord (3.0.0) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
activerecord (3.0.0) lib/active_record/query_cache.rb:12:in `cache'
activerecord (3.0.0) lib/active_record/query_cache.rb:31:in `call'
activerecord (3.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:355:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/callbacks.rb:46:in `call'
activesupport (3.0.0) lib/active_support/callbacks.rb:415:in `_run_call_callbacks'
actionpack (3.0.0) lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.1) lib/rack/sendfile.rb:107:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/show_exceptions.rb:46:in `call'
railties (3.0.0) lib/rails/rack/logger.rb:13:in `call'
rack (1.2.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.0.0) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.1) lib/rack/lock.rb:11:in `call'
rack (1.2.1) lib/rack/lock.rb:11:in `synchronize'
rack (1.2.1) lib/rack/lock.rb:11:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/static.rb:30:in `call'
railties (3.0.0) lib/rails/application.rb:168:in `call'
railties (3.0.0) lib/rails/application.rb:77:in `send'
railties (3.0.0) lib/rails/application.rb:77:in `method_missing'
railties (3.0.0) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.1) lib/rack/content_length.rb:13:in `call'
rack (1.2.1) lib/rack/handler/webrick.rb:52:in `service'
c:/Ruby187/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
c:/Ruby187/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
c:/Ruby187/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
c:/Ruby187/lib/ruby/1.8/webrick/server.rb:162:in `start'
c:/Ruby187/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
c:/Ruby187/lib/ruby/1.8/webrick/server.rb:95:in `start'
c:/Ruby187/lib/ruby/1.8/webrick/server.rb:92:in `each'
c:/Ruby187/lib/ruby/1.8/webrick/server.rb:92:in `start'
c:/Ruby187/lib/ruby/1.8/webrick/server.rb:23:in `start'
c:/Ruby187/lib/ruby/1.8/webrick/server.rb:82:in `start'
rack (1.2.1) lib/rack/handler/webrick.rb:13:in `run'
rack (1.2.1) lib/rack/server.rb:213:in `start'
railties (3.0.0) lib/rails/commands/server.rb:65:in `start'
railties (3.0.0) lib/rails/commands.rb:30
railties (3.0.0) lib/rails/commands.rb:27:in `tap'
railties (3.0.0) lib/rails/commands.rb:27
script/rails:6:in `require'
script/rails:6
Request
Parameters:
{"id"=>"1"}
Show session dump
Show env dump
Response
Headers:
None
I've tried to find someone with similar issues, but to no avail.
I've recopied the whole code for this chapter form the tutorial to make sure it wasn't a typo, still didn't helped.
Thanks for any help given.
I was having the same problem... took a while to figure out.
I had two instances of the show method defined in the UsersController. Once I removed the one that didn't contain a #microposts declaration, (2nd one didn't have #microposts) the tests ran as expected and the page rendered the microposts correctly.
Cheers!
a
Related
Whenever I try to load a page with the 'mercury' editor stylesheet I get:
Started GET "/" for 84.73.28.228 at 2014-05-07 10:56:38 +0000
Processing by StaticController#index as HTML
Rendered layouts/_socialmedia.html.erb (2.0ms)
Rendered static/index.html.erb within layouts/application (6.8ms)
Rendered layouts/_menu.html.erb (1.7ms)
Rendered layouts/_footer.html.erb (1.4ms)
Rendered layouts/_analytics.html.erb (0.3ms)
Completed 200 OK in 29ms (Views: 17.5ms | ActiveRecord: 1.3ms)
Started GET "/editor/" for 84.73.28.228 at 2014-05-07 10:56:41 +0000
Processing by MercuryController#edit as HTML
Rendered text template within layouts/mercury (0.0ms)
Compiled jquery-1.7.js (4ms) (pid 26385)
Completed 500 Internal Server Error in 100ms
ActionView::Template::Error (Permission denied - /home/rails/tmp/cache/assets/D5E):
5: <%= csrf_meta_tags %>
6: <title>Mercury Editor</title>
7: <%= stylesheet_link_tag 'mercury' %>
8: <%= javascript_include_tag 'jquery-1.7', 'mercury' %>
9: </head>
10: <body>
11: <script type="text/javascript">
/usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/fileutils.rb:245:in `mkdir'
/usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/fileutils.rb:245:in `fu_mkdir'
/usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/fileutils.rb:219:in `block (2 levels) in mkdir_p'
/usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/fileutils.rb:217:in `reverse_each'
/usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/fileutils.rb:217:in `block in mkdir_p'
/usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/fileutils.rb:203:in `each'
/usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/fileutils.rb:203:in `mkdir_p'
activesupport (3.2.11) lib/active_support/cache/file_store.rb:161:in `ensure_cache_path'
activesupport (3.2.11) lib/active_support/cache/file_store.rb:90:in `write_entry'
activesupport (3.2.11) lib/active_support/cache/strategy/local_cache.rb:140:in `write_entry'
activesupport (3.2.11) lib/active_support/cache.rb:364:in `block in write'
activesupport (3.2.11) lib/active_support/cache.rb:520:in `instrument'
activesupport (3.2.11) lib/active_support/cache.rb:362:in `write'
sprockets (2.2.2) lib/sprockets/caching.rb:90:in `cache_set'
sprockets (2.2.2) lib/sprockets/caching.rb:53:in `cache_set_hash'
sprockets (2.2.2) lib/sprockets/caching.rb:24:in `cache_asset'
sprockets (2.2.2) lib/sprockets/index.rb:92:in `build_asset'
sprockets (2.2.2) lib/sprockets/base.rb:169:in `find_asset'
sprockets (2.2.2) lib/sprockets/index.rb:60:in `find_asset'
sprockets (2.2.2) lib/sprockets/bundled_asset.rb:16:in `initialize'
sprockets (2.2.2) lib/sprockets/base.rb:252:in `new'
sprockets (2.2.2) lib/sprockets/base.rb:252:in `build_asset'
sprockets (2.2.2) lib/sprockets/index.rb:93:in `block in build_asset'
sprockets (2.2.2) lib/sprockets/caching.rb:19:in `cache_asset'
sprockets (2.2.2) lib/sprockets/index.rb:92:in `build_asset'
sprockets (2.2.2) lib/sprockets/base.rb:169:in `find_asset'
sprockets (2.2.2) lib/sprockets/index.rb:60:in `find_asset'
sprockets (2.2.2) lib/sprockets/base.rb:177:in `[]'
actionpack (3.2.11) lib/sprockets/helpers/rails_helper.rb:162:in `rewrite_extension'
actionpack (3.2.11) lib/action_view/asset_paths.rb:26:in `compute_public_path'
actionpack (3.2.11) lib/sprockets/helpers/rails_helper.rb:56:in `asset_path'
actionpack (3.2.11) lib/sprockets/helpers/rails_helper.rb:32:in `block in javascript_include_tag'
actionpack (3.2.11) lib/sprockets/helpers/rails_helper.rb:26:in `collect'
actionpack (3.2.11) lib/sprockets/helpers/rails_helper.rb:26:in `javascript_include_tag'
mercury-rails (0.9.0) app/views/layouts/mercury.html.erb:8:in `__usr_local_rvm_gems_ruby_______p____gems_mercury_rails_______app_views_layouts_mercury_html_erb__3694222398901886890_33552740'
actionpack (3.2.11) lib/action_view/template.rb:145:in `block in render'
activesupport (3.2.11) lib/active_support/notifications.rb:125:in `instrument'
actionpack (3.2.11) lib/action_view/template.rb:143:in `render'
actionpack (3.2.11) lib/action_view/renderer/template_renderer.rb:59:in `render_with_layout'
actionpack (3.2.11) lib/action_view/renderer/template_renderer.rb:45:in `render_template'
actionpack (3.2.11) lib/action_view/renderer/template_renderer.rb:18:in `render'
actionpack (3.2.11) lib/action_view/renderer/renderer.rb:36:in `render_template'
actionpack (3.2.11) lib/action_view/renderer/renderer.rb:17:in `render'
actionpack (3.2.11) lib/abstract_controller/rendering.rb:110:in `_render_template'
actionpack (3.2.11) lib/action_controller/metal/streaming.rb:225:in `_render_template'
actionpack (3.2.11) lib/abstract_controller/rendering.rb:103:in `render_to_body'
actionpack (3.2.11) lib/action_controller/metal/renderers.rb:28:in `render_to_body'
actionpack (3.2.11) lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
actionpack (3.2.11) lib/abstract_controller/rendering.rb:88:in `render'
actionpack (3.2.11) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (3.2.11) lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
activesupport (3.2.11) lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
/usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/benchmark.rb:296:in `realtime'
activesupport (3.2.11) lib/active_support/core_ext/benchmark.rb:5:in `ms'
actionpack (3.2.11) lib/action_controller/metal/instrumentation.rb:40:in `block in render'
actionpack (3.2.11) lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
activerecord (3.2.11) lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
actionpack (3.2.11) lib/action_controller/metal/instrumentation.rb:39:in `render'
mercury-rails (0.9.0) app/controllers/mercury_controller.rb:9:in `edit'
actionpack (3.2.11) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.11) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.11) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.11) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.11) lib/active_support/callbacks.rb:425:in `_run__4116608381698480854__process_action__2358713743569235138__callbacks'
activesupport (3.2.11) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.11) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.11) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.11) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.11) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.11) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.11) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.11) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.11) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.11) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.11) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
activerecord (3.2.11) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.2.11) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.11) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.11) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.11) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.11) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.11) lib/action_dispatch/routing/route_set.rb:73:in `call'
actionpack (3.2.11) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.11) lib/action_dispatch/routing/route_set.rb:36:in `call'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `each'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.11) lib/action_dispatch/routing/route_set.rb:601:in `call'
railties (3.2.11) lib/rails/engine.rb:479:in `call'
railties (3.2.11) lib/rails/railtie/configurable.rb:30:in `method_missing'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `each'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.11) lib/action_dispatch/routing/route_set.rb:601:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `catch'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.5) lib/rack/etag.rb:23:in `call'
rack (1.4.5) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context'
rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/cookies.rb:341:in `call'
activerecord (3.2.11) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.11) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.11) lib/active_support/callbacks.rb:405:in `_run__3113844860461911926__call__1767113983053102621__callbacks'
activesupport (3.2.11) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.11) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.11) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.11) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.11) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.11) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.11) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.11) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.11) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.5) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.11) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.5) lib/rack/lock.rb:15:in `call'
rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
rack-cache (1.2) lib/rack/cache/context.rb:245:in `fetch'
rack-cache (1.2) lib/rack/cache/context.rb:185:in `lookup'
rack-cache (1.2) lib/rack/cache/context.rb:66:in `call!'
rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
railties (3.2.11) lib/rails/engine.rb:479:in `call'
railties (3.2.11) lib/rails/application.rb:223:in `call'
railties (3.2.11) lib/rails/railtie/configurable.rb:30:in `method_missing'
unicorn (4.7.0) lib/unicorn/http_server.rb:580:in `process_client'
unicorn (4.7.0) lib/unicorn/http_server.rb:660:in `worker_loop'
unicorn (4.7.0) lib/unicorn/http_server.rb:527:in `spawn_missing_workers'
unicorn (4.7.0) lib/unicorn/http_server.rb:153:in `start'
unicorn (4.7.0) bin/unicorn:126:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.0.0-p353/bin/unicorn:23:in `load'
/usr/local/rvm/gems/ruby-2.0.0-p353/bin/unicorn:23:in `<main>'
/usr/local/rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `<main>'
I've tried
chown -R rails:rails /home/rails.
I've tried deleting tmp and recreating it.
I've tried precompiling assets and clearing the chache. I've tried increasing the asset version.
Database acess works fine. This all happens in a production environment. I've given my rails user root privileges, everything, but he doesn't want to quit complaining.
I use the digital ocean rails droplet, it has nginx with unicorn.
Any ideas?
I have none on where to begin...
After chown-ing some more directories, I finally get another error:
ActionView::Template::Error (jquery-1.7.js isn't precompiled):.
Exclusively adding this to the asset pipeline; Then on precompiling assets it gave me: Command failed with status ().
So it turns out the default rails droplet provided by digital ocean is 64 bit with 500mb RAM, which causes rails to do all these weird things because it can't breathe. Doing my own thing from a 34 bit distro solved the problem.
So I just upgraded to FontAwesome 4.0. Part of this change is the way icons are referenced.
No longer can you do: <i class="icon-beer"></i>.
Now...you have to replace icon with fa-, so the above now looks like this:
<i class="fa fa-beer"></i>
So in a stroke of brilliance I decided to replace all references to icon- in my project with fa fa-.
That included cached files, dump files, and all stylesheets, views, etc.
Now...when I try to load any page, I get this error:
ArgumentError at /
dump format error for symbol(0x69)
The log looks like this:
Completed 500 Internal Server Error in 1060ms
ArgumentError - dump format error for symbol(0x69):
activesupport (3.2.14) lib/active_support/cache.rb:587:in `value'
activesupport (3.2.14) lib/active_support/cache.rb:324:in `block in read'
activesupport (3.2.14) lib/active_support/cache.rb:520:in `instrument'
activesupport (3.2.14) lib/active_support/cache.rb:315:in `read'
sprockets (2.2.2) lib/sprockets/caching.rb:70:in `cache_get'
sprockets (2.2.2) lib/sprockets/caching.rb:45:in `cache_get_hash'
sprockets (2.2.2) lib/sprockets/caching.rb:15:in `cache_asset'
sprockets (2.2.2) lib/sprockets/index.rb:92:in `build_asset'
sprockets (2.2.2) lib/sprockets/base.rb:169:in `find_asset'
sprockets (2.2.2) lib/sprockets/index.rb:60:in `find_asset'
sprockets (2.2.2) lib/sprockets/environment.rb:78:in `find_asset'
sprockets (2.2.2) lib/sprockets/base.rb:177:in `[]'
actionpack (3.2.14) lib/sprockets/helpers/rails_helper.rb:126:in `asset_for'
actionpack (3.2.14) lib/sprockets/helpers/rails_helper.rb:44:in `block in stylesheet_link_tag'
actionpack (3.2.14) lib/sprockets/helpers/rails_helper.rb:43:in `stylesheet_link_tag'
app/views/layouts/application.html.erb:7:in `_app_views_layouts_application_html_erb___3926009726657617670_70158405610280'
actionpack (3.2.14) lib/action_view/template.rb:145:in `block in render'
activesupport (3.2.14) lib/active_support/notifications.rb:125:in `instrument'
actionpack (3.2.14) lib/action_view/template.rb:143:in `render'
rack-mini-profiler (0.1.31) Ruby/lib/mini_profiler/profiling_methods.rb:108:in `block in profile_method'
actionpack (3.2.14) lib/action_view/renderer/template_renderer.rb:60:in `render_with_layout'
actionpack (3.2.14) lib/action_view/renderer/template_renderer.rb:46:in `render_template'
actionpack (3.2.14) lib/action_view/renderer/template_renderer.rb:19:in `render'
newrelic_rpm (3.6.8.168) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:160:in `block in render_with_newrelic'
newrelic_rpm (3.6.8.168) lib/new_relic/agent/method_tracer.rb:259:in `trace_execution_scoped'
newrelic_rpm (3.6.8.168) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:159:in `render_with_newrelic'
actionpack (3.2.14) lib/action_view/renderer/renderer.rb:36:in `render_template'
actionpack (3.2.14) lib/action_view/renderer/renderer.rb:17:in `render'
actionpack (3.2.14) lib/abstract_controller/rendering.rb:110:in `_render_template'
actionpack (3.2.14) lib/action_controller/metal/streaming.rb:225:in `_render_template'
actionpack (3.2.14) lib/abstract_controller/rendering.rb:103:in `render_to_body'
actionpack (3.2.14) lib/action_controller/metal/renderers.rb:28:in `render_to_body'
actionpack (3.2.14) lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
actionpack (3.2.14) lib/abstract_controller/rendering.rb:88:in `render'
actionpack (3.2.14) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (3.2.14) lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
activesupport (3.2.14) lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
/me/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/benchmark.rb:296:in `realtime'
activesupport (3.2.14) lib/active_support/core_ext/benchmark.rb:5:in `ms'
actionpack (3.2.14) lib/action_controller/metal/instrumentation.rb:40:in `block in render'
actionpack (3.2.14) lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
activerecord (3.2.14) lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
actionpack (3.2.14) lib/action_controller/metal/instrumentation.rb:39:in `render'
remotipart (1.2.1) lib/remotipart/render_overrides.rb:14:in `render_with_remotipart'
actionpack (3.2.14) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (3.2.14) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (3.2.14) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.14) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.14) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.14) lib/active_support/callbacks.rb:436:in `_run__3106556048525796011__process_action__1470226244061007336__callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.14) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.14) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.14) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.14) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.14) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.14) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.14) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.14) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.14) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
activerecord (3.2.14) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
newrelic_rpm (3.6.8.168) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:38:in `block in process_action'
newrelic_rpm (3.6.8.168) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:324:in `perform_action_with_newrelic_trace'
newrelic_rpm (3.6.8.168) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:37:in `process_action'
actionpack (3.2.14) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.14) lib/abstract_controller/rendering.rb:45:in `process'
rack-mini-profiler (0.1.31) Ruby/lib/mini_profiler/profiling_methods.rb:108:in `block in profile_method'
actionpack (3.2.14) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.14) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.14) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.14) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.14) lib/action_dispatch/routing/route_set.rb:36:in `call'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.14) lib/action_dispatch/routing/route_set.rb:608:in `call'
rack-pjax (0.7.0) lib/rack/pjax.rb:12:in `call'
newrelic_rpm (3.6.8.168) lib/new_relic/rack/error_collector.rb:43:in `call'
newrelic_rpm (3.6.8.168) lib/new_relic/rack/agent_hooks.rb:22:in `call'
newrelic_rpm (3.6.8.168) lib/new_relic/rack/browser_monitoring.rb:16:in `call'
bullet (4.6.0) lib/bullet/rack.rb:10:in `call'
meta_request (0.2.8) lib/meta_request/middlewares/app_request_handler.rb:13:in `call'
rack-contrib (1.1.0) lib/rack/contrib/response_headers.rb:17:in `call'
meta_request (0.2.8) lib/meta_request/middlewares/headers.rb:16:in `call'
meta_request (0.2.8) lib/meta_request/middlewares/meta_request_handler.rb:13:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.5) lib/rack/etag.rb:23:in `call'
rack (1.4.5) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/head.rb:14:in `call'
remotipart (1.2.1) lib/remotipart/middleware.rb:27:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context'
rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/cookies.rb:341:in `call'
activerecord (3.2.14) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.14) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.14) lib/active_support/callbacks.rb:405:in `_run__1838779961944472927__call__2777002074146462717__callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.14) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.14) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.14) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
better_errors (1.0.1) lib/better_errors/middleware.rb:84:in `protected_app_call'
better_errors (1.0.1) lib/better_errors/middleware.rb:79:in `better_errors_call'
better_errors (1.0.1) lib/better_errors/middleware.rb:56:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.14) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.14) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.14) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.14) lib/rails/rack/logger.rb:16:in `call'
quiet_assets (1.0.2) lib/quiet_assets.rb:18:in `call_with_quiet_assets'
actionpack (3.2.14) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.5) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.14) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.5) lib/rack/lock.rb:15:in `call'
actionpack (3.2.14) lib/action_dispatch/middleware/static.rb:63:in `call'
rack-mini-profiler (0.1.31) Ruby/lib/mini_profiler/profiler.rb:278:in `call'
railties (3.2.14) lib/rails/engine.rb:484:in `call'
railties (3.2.14) lib/rails/application.rb:231:in `call'
rack (1.4.5) lib/rack/content_length.rb:14:in `call'
railties (3.2.14) lib/rails/rack/log_tailer.rb:17:in `call'
thin (1.5.1) lib/thin/connection.rb:81:in `block in pre_process'
thin (1.5.1) lib/thin/connection.rb:79:in `pre_process'
thin (1.5.1) lib/thin/connection.rb:54:in `process'
thin (1.5.1) lib/thin/connection.rb:39:in `receive_data'
eventmachine (1.0.3) lib/eventmachine.rb:187:in `run'
thin (1.5.1) lib/thin/backends/base.rb:63:in `start'
thin (1.5.1) lib/thin/server.rb:159:in `start'
rack (1.4.5) lib/rack/handler/thin.rb:13:in `run'
rack (1.4.5) lib/rack/server.rb:268:in `start'
railties (3.2.14) lib/rails/commands/server.rb:70:in `start'
railties (3.2.14) lib/rails/commands.rb:55:in `block in <top (required)>'
railties (3.2.14) lib/rails/commands.rb:50:in `<top (required)>'
script/rails:6:in `<main>'
Thoughts on how I can fix this?
this happened to me, and i guessed that the reason was the global find-and-replace mucked around in the tmp directory, which caused some asset compilation problems
so i ran
rake tmp:clear
and the problem went away. maybe this helps someone.
You should first try to reverse the process, replacing every fa fa- with icon- again.
After that you can try to do the replacement again but only with your views folder, which should contain all the icon markup.
I ran into a similar problem, running perl -pi -e to replace references to a directory with something else:
dump format error for symbol(0x73).
In my case the problem turned out to be that a file with some SASS variables I had was suffixed ".css.scss" instead of ".scss", which for some reason broke the whole app.
Hi all SO users fixing bugs on Thanksgiving,
My delayed job setup is working fine, I have it running in production and development, but when accessing the users section of rails admin, I get the error
uninitialized constant ActiveRecord::Base::Delayed::Job
Am I supposed to define a delayed job class somewhere? If so, what's the correct syntax for that? Delayed::Job or DelayedJob? I've tried doing this with no success.
I also ran the migration to create the jobs table. Maybe there is an association between user and delayed job that is defined somewhere? Not too sure...
Here's a full trace:
ActionView::Template::Error (uninitialized constant ActiveRecord::Base::Delayed::Job):
10:
11: export_action = RailsAdmin::Config::Actions.find(:export, { :controller => self.controller, :abstract_model => #abstract_model })
12: export_action = export_action && authorized?(export_action.authorization_key, #abstract_model) ? export_action : nil
13:
14: properties = #model_config.list.with(:controller => self.controller, :view => self, :object => #abstract_model.model.new).visible_fields
15: # columns paginate
16: #filterable_fields = #model_config.list.fields.select(&:filterable?)
activerecord (3.2.3) lib/active_record/inheritance.rb:119:in `compute_type'
activerecord (3.2.3) lib/active_record/reflection.rb:172:in `klass'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/lib/rails_admin/adapters/active_record.rb:233:in `association_model_lookup'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/lib/rails_admin/adapters/active_record.rb:70:in `block (2 levels) in associations'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/lib/rails_admin/config/fields/association.rb:63:in `call'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/lib/rails_admin/config/fields/association.rb:63:in `associated_model_config'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/lib/rails_admin/config/fields/association.rb:33:in `block in <class:Association>'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/lib/rails_admin/config/configurable.rb:68:in `instance_eval'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/lib/rails_admin/config/configurable.rb:68:in `block in register_instance_option'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/lib/rails_admin/config/configurable.rb:42:in `block in register_instance_option'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/lib/rails_admin/config/proxyable/proxy.rb:31:in `method_missing'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/lib/rails_admin/config/has_fields.rb:113:in `select'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/lib/rails_admin/config/has_fields.rb:113:in `visible_fields'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/lib/rails_admin/config/proxyable/proxy.rb:31:in `method_missing'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/app/views/rails_admin/main/index.html.haml:13:in `__var_www_apps_miracleticket_shared_bundle_ruby_______bundler_gems_rails_admin____e____d__f_app_views_rails_admin_main_index_html_haml___3620510256847226470_59069620'
actionpack (3.2.3) lib/action_view/template.rb:143:in `block in render'
activesupport (3.2.3) lib/active_support/notifications.rb:125:in `instrument'
actionpack (3.2.3) lib/action_view/template.rb:141:in `render'
actionpack (3.2.3) lib/action_view/renderer/template_renderer.rb:47:in `block (2 levels) in render_template'
actionpack (3.2.3) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (3.2.3) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.3) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.3) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.3) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionpack (3.2.3) lib/action_view/renderer/template_renderer.rb:46:in `block in render_template'
actionpack (3.2.3) lib/action_view/renderer/template_renderer.rb:54:in `render_with_layout'
actionpack (3.2.3) lib/action_view/renderer/template_renderer.rb:45:in `render_template'
actionpack (3.2.3) lib/action_view/renderer/template_renderer.rb:18:in `render'
newrelic_rpm (3.5.0.1) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:156:in `block in render_with_newrelic'
newrelic_rpm (3.5.0.1) lib/new_relic/agent/method_tracer.rb:242:in `trace_execution_scoped'
newrelic_rpm (3.5.0.1) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:155:in `render_with_newrelic'
actionpack (3.2.3) lib/action_view/renderer/renderer.rb:36:in `render_template'
actionpack (3.2.3) lib/action_view/renderer/renderer.rb:17:in `render'
actionpack (3.2.3) lib/abstract_controller/rendering.rb:110:in `_render_template'
actionpack (3.2.3) lib/action_controller/metal/streaming.rb:225:in `_render_template'
actionpack (3.2.3) lib/abstract_controller/rendering.rb:103:in `render_to_body'
actionpack (3.2.3) lib/action_controller/metal/renderers.rb:28:in `render_to_body'
actionpack (3.2.3) lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
actionpack (3.2.3) lib/abstract_controller/rendering.rb:88:in `render'
actionpack (3.2.3) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (3.2.3) lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
activesupport (3.2.3) lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
/home/shark/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
activesupport (3.2.3) lib/active_support/core_ext/benchmark.rb:5:in `ms'
actionpack (3.2.3) lib/action_controller/metal/instrumentation.rb:40:in `block in render'
actionpack (3.2.3) lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
activerecord (3.2.3) lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
actionpack (3.2.3) lib/action_controller/metal/instrumentation.rb:39:in `render'
remotipart (1.0.2) lib/remotipart/render_overrides.rb:8:in `render'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/lib/rails_admin/config/actions/index.rb:35:in `block (4 levels) in <class:Index>'
actionpack (3.2.3) lib/action_controller/metal/mime_responds.rb:196:in `call'
actionpack (3.2.3) lib/action_controller/metal/mime_responds.rb:196:in `respond_to'
/var/www/apps/miracleticket/shared/bundle/ruby/1.9.1/bundler/gems/rails_admin-556e9032d23f/lib/rails_admin/config/actions/index.rb:32:in `block (2 levels) in <class:Index>'
(eval):8:in `instance_eval'
(eval):8:in `index'
actionpack (3.2.3) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.3) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.3) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.3) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.3) lib/active_support/callbacks.rb:524:in `_run__2345189654170037202__process_action__1989048903076684056__callbacks'
activesupport (3.2.3) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.3) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.3) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.3) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.3) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.3) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.3) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.3) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.3) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.3) lib/action_controller/metal/params_wrapper.rb:205:in `process_action'
activerecord (3.2.3) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
newrelic_rpm (3.5.0.1) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:34:in `block in process_action'
newrelic_rpm (3.5.0.1) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:268:in `block in perform_action_with_newrelic_trace'
newrelic_rpm (3.5.0.1) lib/new_relic/agent/method_tracer.rb:242:in `trace_execution_scoped'
newrelic_rpm (3.5.0.1) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:263:in `perform_action_with_newrelic_trace'
newrelic_rpm (3.5.0.1) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:33:in `process_action'
actionpack (3.2.3) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.3) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.3) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.3) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.3) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:73:in `call'
actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:36:in `call'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `each'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:600:in `call'
railties (3.2.3) lib/rails/engine.rb:479:in `call'
railties (3.2.3) lib/rails/railtie/configurable.rb:30:in `method_missing'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `each'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:600:in `call'
rack-pjax (0.6.0) lib/rack/pjax.rb:12:in `call'
omniauth (1.1.1) lib/omniauth/strategy.rb:177:in `call!'
omniauth (1.1.1) lib/omniauth/strategy.rb:157:in `call'
newrelic_rpm (3.5.0.1) lib/new_relic/rack/error_collector.rb:8:in `call'
newrelic_rpm (3.5.0.1) lib/new_relic/rack/browser_monitoring.rb:12:in `call'
sass (3.2.2) lib/sass/plugin/rack.rb:54:in `call'
exception_notification (3.0.0) lib/exception_notifier.rb:40:in `call'
warden (1.2.1) lib/warden/manager.rb:35:in `block in call'
warden (1.2.1) lib/warden/manager.rb:34:in `catch'
warden (1.2.1) lib/warden/manager.rb:34:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.1) lib/rack/etag.rb:23:in `call'
rack (1.4.1) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/head.rb:14:in `call'
remotipart (1.0.2) lib/remotipart/middleware.rb:30:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context'
rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/cookies.rb:338:in `call'
activerecord (3.2.3) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.3) lib/active_record/connection_adapters/abstract/connection_pool.rb:467:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.3) lib/active_support/callbacks.rb:405:in `_run__3685644371886104563__call__3962699592338143344__callbacks'
activesupport (3.2.3) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.3) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.3) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
rack (1.4.1) lib/rack/sendfile.rb:102:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.3) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.3) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
rack-cache (1.2) lib/rack/cache/context.rb:245:in `fetch'
rack-cache (1.2) lib/rack/cache/context.rb:185:in `lookup'
rack-cache (1.2) lib/rack/cache/context.rb:66:in `call!'
rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
railties (3.2.3) lib/rails/engine.rb:479:in `call'
railties (3.2.3) lib/rails/application.rb:220:in `call'
railties (3.2.3) lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/rack/application_spawner.rb:206:in `start_request_handler'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/rack/application_spawner.rb:171:in `block in handle_spawn_application'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/utils.rb:479:in `safe_fork'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/rack/application_spawner.rb:166:in `handle_spawn_application'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb:180:in `start'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/rack/application_spawner.rb:129:in `start'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
<internal:prelude>:10:in `synchronize'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
/home/shark/.rvm/gems/ruby-1.9.3-p194/gems/passenger-3.0.12/helper-scripts/passenger-spawn-server:99:in `<main>'
It looks like some class somewhere is associated with the Delayed::Job class. I'm guessing that you've got the class_name option on that association with Delayed::Job specified. I'm not sure how that would work in practice as Delayed::Job isn't an active record class. You'd really have to associate with the active record backend for delayed jobs (Delayed::Backend::ActiveRecord::Job).
In the first instance it'd be worth commenting out that association and seeing if it works without it. In the second instance it'd be worth rethinking how to associate your users with the jobs being processed.
I'm working on making an image server that is similar to that of Flickr's. In my routes file I have:
get "/image/server/:secret_:id(_:size).:format", :to => "api/images#server", :as => :api_image
And then in my view I'm calling the following but keep getting a ActionController::RoutingError exception:
api_image_path({ :secret=>"07fde2a9c76de3d16fb70e772d944652", :id=>2, :size=>"t", :format=>"png" })
Error:
No route matches {:controller=>"api/images", :action=>"server", :secret=>"07fde2a9c76de3d16fb70e772d944652", :id=>2, :size=>"t", :format=>"png"}
Update
The Request parameters look like the following. It seems like it's not detecting the underscore between the secret and id. It's merging it all into secret. For example if I request: http://example.com/image/server/07fde2a9c76de3d16fb70e772d944652_2_n.jpg I'll get the following in my params:
{"secret_"=>"07fde2a9c76de3d16fb70e772d944652_2_",
"id"=>"n",
"format"=>"jpg"}
It's taking the whole string right up to before the _n and assigning that to secret, which for some reason it's calling it secret_.
ActionController::RoutingError (Full Trace)
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:424:in `raise_routing_error'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:397:in `generate'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:453:in `generate'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:481:in `url_for'
actionpack (3.0.3) lib/action_dispatch/routing/url_for.rb:131:in `url_for'
actionpack (3.0.3) lib/action_view/helpers/url_helper.rb:99:in `url_for'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:195:in `api_image_url'
app/views/services/about.html.erb:8:in `_app_views_services_about_html_erb__1824827504506770107_2158066880_1802331327662141069'
actionpack (3.0.3) lib/action_view/template.rb:135:in `block in render'
activesupport (3.0.3) lib/active_support/notifications.rb:54:in `instrument'
actionpack (3.0.3) lib/action_view/template.rb:127:in `render'
actionpack (3.0.3) lib/action_view/render/rendering.rb:59:in `block in _render_template'
activesupport (3.0.3) lib/active_support/notifications.rb:52:in `block in instrument'
activesupport (3.0.3) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.3) lib/active_support/notifications.rb:52:in `instrument'
actionpack (3.0.3) lib/action_view/render/rendering.rb:56:in `_render_template'
actionpack (3.0.3) lib/action_view/render/rendering.rb:26:in `render'
actionpack (3.0.3) lib/abstract_controller/rendering.rb:114:in `_render_template'
actionpack (3.0.3) lib/abstract_controller/rendering.rb:108:in `render_to_body'
actionpack (3.0.3) lib/action_controller/metal/renderers.rb:47:in `render_to_body'
actionpack (3.0.3) lib/action_controller/metal/compatibility.rb:55:in `render_to_body'
actionpack (3.0.3) lib/abstract_controller/rendering.rb:101:in `render_to_string'
actionpack (3.0.3) lib/abstract_controller/rendering.rb:92:in `render'
actionpack (3.0.3) lib/action_controller/metal/rendering.rb:17:in `render'
actionpack (3.0.3) lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
activesupport (3.0.3) lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
/usr/local/Cellar/ruby/1.9.2-p0/lib/ruby/1.9.1/benchmark.rb:309:in `realtime'
activesupport (3.0.3) lib/active_support/core_ext/benchmark.rb:5:in `ms'
actionpack (3.0.3) lib/action_controller/metal/instrumentation.rb:40:in `block in render'
actionpack (3.0.3) lib/action_controller/metal/instrumentation.rb:78:in `cleanup_view_runtime'
activerecord (3.0.3) lib/active_record/railties/controller_runtime.rb:15:in `cleanup_view_runtime'
thinking-sphinx (2.0.3) lib/thinking_sphinx/action_controller.rb:12:in `cleanup_view_runtime'
actionpack (3.0.3) lib/action_controller/metal/instrumentation.rb:39:in `render'
actionpack (3.0.3) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (3.0.3) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.0.3) lib/abstract_controller/base.rb:151:in `process_action'
actionpack (3.0.3) lib/action_controller/metal/rendering.rb:11:in `process_action'
actionpack (3.0.3) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.0.3) lib/active_support/callbacks.rb:456:in `block in _run__3222905760235059467__process_action__3328463717343760166__callbacks'
activesupport (3.0.3) lib/active_support/callbacks.rb:220:in `block in _conditional_callback_around_188'
activesupport (3.0.3) lib/active_support/callbacks.rb:330:in `around'
activesupport (3.0.3) lib/active_support/callbacks.rb:314:in `_callback_around_35'
activesupport (3.0.3) lib/active_support/callbacks.rb:219:in `_conditional_callback_around_188'
activesupport (3.0.3) lib/active_support/callbacks.rb:435:in `_run__3222905760235059467__process_action__3328463717343760166__callbacks'
activesupport (3.0.3) lib/active_support/callbacks.rb:409:in `_run_process_action_callbacks'
activesupport (3.0.3) lib/active_support/callbacks.rb:93:in `run_callbacks'
actionpack (3.0.3) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.0.3) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.0.3) lib/active_support/notifications.rb:52:in `block in instrument'
activesupport (3.0.3) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.3) lib/active_support/notifications.rb:52:in `instrument'
actionpack (3.0.3) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.0.3) lib/action_controller/metal/rescue.rb:17:in `process_action'
actionpack (3.0.3) lib/abstract_controller/base.rb:120:in `process'
actionpack (3.0.3) lib/abstract_controller/rendering.rb:40:in `process'
actionpack (3.0.3) lib/action_controller/metal.rb:138:in `dispatch'
actionpack (3.0.3) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.0.3) lib/action_controller/metal.rb:178:in `block in action'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:62:in `call'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:27:in `call'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:148:in `block in call'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:93:in `block in recognize'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:75:in `optimized_each'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:92:in `recognize'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:139:in `call'
actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:492:in `call'
oa-core (0.2.1) lib/omniauth/strategy.rb:55:in `call!'
oa-core (0.2.1) lib/omniauth/strategy.rb:22:in `call'
oa-core (0.2.1) lib/omniauth/strategy.rb:55:in `call!'
oa-core (0.2.1) lib/omniauth/strategy.rb:22:in `call'
oa-core (0.2.1) lib/omniauth/strategy.rb:55:in `call!'
oa-core (0.2.1) lib/omniauth/strategy.rb:22:in `call'
oa-core (0.2.1) lib/omniauth/builder.rb:30:in `call'
lib/flash_session_cookie_middleware.rb:20:in `call'
warden (1.0.3) lib/warden/manager.rb:35:in `block in call'
warden (1.0.3) lib/warden/manager.rb:34:in `catch'
warden (1.0.3) lib/warden/manager.rb:34:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/head.rb:14:in `call'
rack (1.2.2) lib/rack/methodoverride.rb:24:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/flash.rb:182:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
lib/flash_session_cookie_middleware.rb:20:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/cookies.rb:295:in `call'
activerecord (3.0.3) lib/active_record/query_cache.rb:32:in `block in call'
activerecord (3.0.3) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
activerecord (3.0.3) lib/active_record/query_cache.rb:12:in `cache'
activerecord (3.0.3) lib/active_record/query_cache.rb:31:in `call'
activerecord (3.0.3) lib/active_record/connection_adapters/abstract/connection_pool.rb:353:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/callbacks.rb:46:in `block in call'
activesupport (3.0.3) lib/active_support/callbacks.rb:415:in `_run_call_callbacks'
actionpack (3.0.3) lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.2) lib/rack/sendfile.rb:107:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/show_exceptions.rb:46:in `call'
railties (3.0.3) lib/rails/rack/logger.rb:13:in `call'
rack (1.2.2) lib/rack/runtime.rb:17:in `call'
activesupport (3.0.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.2) lib/rack/lock.rb:11:in `block in call'
<internal:prelude>:10:in `synchronize'
rack (1.2.2) lib/rack/lock.rb:11:in `call'
actionpack (3.0.3) lib/action_dispatch/middleware/static.rb:30:in `call'
railties (3.0.3) lib/rails/application.rb:168:in `call'
railties (3.0.3) lib/rails/application.rb:77:in `method_missing'
passenger (3.0.2) lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
passenger (3.0.2) lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
passenger (3.0.2) lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
passenger (3.0.2) lib/phusion_passenger/rack/application_spawner.rb:205:in `start_request_handler'
passenger (3.0.2) lib/phusion_passenger/rack/application_spawner.rb:170:in `block in handle_spawn_application'
passenger (3.0.2) lib/phusion_passenger/utils.rb:479:in `safe_fork'
passenger (3.0.2) lib/phusion_passenger/rack/application_spawner.rb:165:in `handle_spawn_application'
passenger (3.0.2) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
passenger (3.0.2) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
passenger (3.0.2) lib/phusion_passenger/abstract_server.rb:180:in `start'
passenger (3.0.2) lib/phusion_passenger/rack/application_spawner.rb:128:in `start'
passenger (3.0.2) lib/phusion_passenger/spawn_manager.rb:253:in `block (2 levels) in spawn_rack_application'
passenger (3.0.2) lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
passenger (3.0.2) lib/phusion_passenger/spawn_manager.rb:246:in `block in spawn_rack_application'
passenger (3.0.2) lib/phusion_passenger/abstract_server_collection.rb:82:in `block in synchronize'
<internal:prelude>:10:in `synchronize'
passenger (3.0.2) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
passenger (3.0.2) lib/phusion_passenger/spawn_manager.rb:244:in `spawn_rack_application'
passenger (3.0.2) lib/phusion_passenger/spawn_manager.rb:137:in `spawn_application'
passenger (3.0.2) lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
passenger (3.0.2) lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
passenger (3.0.2) lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
passenger (3.0.2) helper-scripts/passenger-spawn-server:99:in `<main>'
The issues it that the Routing Parser only supports forward slash, dot and question marker as the seperator in it's default collection, so it doesn't see the '_' as a valid separator and your are getting a match off everything except one character for :id when you match. Additionally your parameter is secret_ because the router doesn't recognize _ as a separator and includes it in your segment name.
I think your choices are either to move from _ to forward slash (this would at least temporarily confirm if the problem is real. Or write a custom constraint as described in section 3.8 and 3.10 of the routing guide here: http://guides.rubyonrails.org/routing.html#advanced-constraints
You can read more on the route matching here: http://apidock.com/rails/ActionController/Routing
and here
https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/routing/mapper.rb
Underscore is a valid character for a URL parameter. I hope this would solve your problem
get "/image/server/:secret_:id(_:size).:format", :to => "api/images#server", :as => :api_image, :contraints => {:secret => /[\w\d]+/, :id => /[\d]+/, :size => /\w/}
On my rails app I have implemented AuthLogic and CanCan. However when trying to figure out if the user can manage an article (checks if he is owner through the article.user_id) with CanCan I am running into issues. This should be straight forward I don't know what I'm doing wrong.
User has_many Articles
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new
can :read, :all
can :manage, Article do |article|
article.user_id == user.id
end
end
end
I get the following error when going to /articles/index
undefined method `user' for #<Array:0x1035c5158>
Extracted source (around line #15):
12: <td><%= article.created_at %></td>
13: <td><%= article.user.login %></td>
14: <td><%= link_to 'View', article %></td>
15: <% if can? :manage, article %>
16: <td><%= link_to 'Edit', edit_article_path(article) %></td>
17: <% end %>
18: <% if can? :manage, article %>
app/models/ability.rb:9:in `try'
app/models/ability.rb:9:in `initialize'
cancan (1.3.4) lib/cancan/can_definition.rb:101:in `call'
cancan (1.3.4) lib/cancan/can_definition.rb:101:in `call_block'
cancan (1.3.4) lib/cancan/can_definition.rb:29:in `matches_conditions?'
cancan (1.3.4) lib/cancan/ability.rb:54:in `can?'
authlogic (2.1.6) lib/authlogic/session/password.rb:127:in `detect'
cancan (1.3.4) lib/cancan/ability.rb:53:in `each'
cancan (1.3.4) lib/cancan/ability.rb:53:in `detect'
cancan (1.3.4) lib/cancan/ability.rb:53:in `can?'
cancan (1.3.4) lib/cancan/controller_additions.rb:228:in `can?'
actionpack (3.0.0) lib/abstract_controller/helpers.rb:55:in `send'
actionpack (3.0.0) lib/abstract_controller/helpers.rb:55:in `can?'
app/views/articles/_articles.html.erb:15:in `_app_views_articles__articles_html_erb__1624837607_2174751840_1924990'
app/views/articles/_articles.html.erb:8:in `each'
app/views/articles/_articles.html.erb:8:in `_app_views_articles__articles_html_erb__1624837607_2174751840_1924990'
actionpack (3.0.0) lib/action_view/template.rb:135:in `send'
actionpack (3.0.0) lib/action_view/template.rb:135:in `render'
activesupport (3.0.0) lib/active_support/notifications.rb:54:in `instrument'
actionpack (3.0.0) lib/action_view/template.rb:127:in `render'
actionpack (3.0.0) lib/action_view/render/partials.rb:294:in `render_partial'
actionpack (3.0.0) lib/action_view/render/partials.rb:223:in `render'
activesupport (3.0.0) lib/active_support/notifications.rb:52:in `instrument'
activesupport (3.0.0) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.0) lib/active_support/notifications.rb:52:in `instrument'
actionpack (3.0.0) lib/action_view/render/partials.rb:221:in `render'
actionpack (3.0.0) lib/action_view/render/partials.rb:334:in `_render_partial'
actionpack (3.0.0) lib/action_view/render/rendering.rb:31:in `render'
app/views/articles/index.html.erb:5:in `_app_views_articles_index_html_erb___1319251192_2174766940_0'
actionpack (3.0.0) lib/action_view/template.rb:135:in `send'
actionpack (3.0.0) lib/action_view/template.rb:135:in `render'
activesupport (3.0.0) lib/active_support/notifications.rb:54:in `instrument'
actionpack (3.0.0) lib/action_view/template.rb:127:in `render'
actionpack (3.0.0) lib/action_view/render/rendering.rb:59:in `_render_template'
activesupport (3.0.0) lib/active_support/notifications.rb:52:in `instrument'
activesupport (3.0.0) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.0) lib/active_support/notifications.rb:52:in `instrument'
actionpack (3.0.0) lib/action_view/render/rendering.rb:56:in `_render_template'
actionpack (3.0.0) lib/action_view/render/rendering.rb:26:in `render'
actionpack (3.0.0) lib/abstract_controller/rendering.rb:114:in `_render_template'
actionpack (3.0.0) lib/abstract_controller/rendering.rb:108:in `render_to_body'
actionpack (3.0.0) lib/action_controller/metal/renderers.rb:47:in `render_to_body'
actionpack (3.0.0) lib/action_controller/metal/compatibility.rb:55:in `render_to_body'
actionpack (3.0.0) lib/abstract_controller/rendering.rb:101:in `render_to_string'
actionpack (3.0.0) lib/abstract_controller/rendering.rb:92:in `render'
actionpack (3.0.0) lib/action_controller/metal/rendering.rb:17:in `render'
actionpack (3.0.0) lib/action_controller/metal/instrumentation.rb:40:in `render'
activesupport (3.0.0) lib/active_support/core_ext/benchmark.rb:5:in `ms'
/opt/local/lib/ruby/1.8/benchmark.rb:308:in `realtime'
activesupport (3.0.0) lib/active_support/core_ext/benchmark.rb:5:in `ms'
actionpack (3.0.0) lib/action_controller/metal/instrumentation.rb:40:in `render'
actionpack (3.0.0) lib/action_controller/metal/instrumentation.rb:78:in `cleanup_view_runtime'
activerecord (3.0.0) lib/active_record/railties/controller_runtime.rb:15:in `cleanup_view_runtime'
actionpack (3.0.0) lib/action_controller/metal/instrumentation.rb:39:in `render'
actionpack (3.0.0) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (3.0.0) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (3.0.0) lib/abstract_controller/base.rb:150:in `process_action'
actionpack (3.0.0) lib/action_controller/metal/rendering.rb:11:in `process_action'
actionpack (3.0.0) lib/abstract_controller/callbacks.rb:18:in `process_action'
activesupport (3.0.0) lib/active_support/callbacks.rb:440:in `_run__704842227__process_action__199225275__callbacks'
activesupport (3.0.0) lib/active_support/callbacks.rb:409:in `send'
activesupport (3.0.0) lib/active_support/callbacks.rb:409:in `_run_process_action_callbacks'
activesupport (3.0.0) lib/active_support/callbacks.rb:93:in `send'
activesupport (3.0.0) lib/active_support/callbacks.rb:93:in `run_callbacks'
actionpack (3.0.0) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.0.0) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
activesupport (3.0.0) lib/active_support/notifications.rb:52:in `instrument'
activesupport (3.0.0) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.0) lib/active_support/notifications.rb:52:in `instrument'
actionpack (3.0.0) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.0.0) lib/action_controller/metal/rescue.rb:17:in `process_action'
actionpack (3.0.0) lib/abstract_controller/base.rb:119:in `process'
actionpack (3.0.0) lib/abstract_controller/rendering.rb:40:in `process'
actionpack (3.0.0) lib/action_controller/metal.rb:133:in `dispatch'
actionpack (3.0.0) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.0.0) lib/action_controller/metal.rb:173:in `action'
actionpack (3.0.0) lib/action_dispatch/routing/route_set.rb:62:in `call'
actionpack (3.0.0) lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
actionpack (3.0.0) lib/action_dispatch/routing/route_set.rb:27:in `call'
rack-mount (0.6.13) lib/rack/mount/route_set.rb:148:in `call'
rack-mount (0.6.13) lib/rack/mount/code_generation.rb:93:in `recognize'
rack-mount (0.6.13) lib/rack/mount/code_generation.rb:68:in `optimized_each'
rack-mount (0.6.13) lib/rack/mount/code_generation.rb:92:in `recognize'
rack-mount (0.6.13) lib/rack/mount/route_set.rb:139:in `call'
actionpack (3.0.0) lib/action_dispatch/routing/route_set.rb:492:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/head.rb:14:in `call'
rack (1.2.1) lib/rack/methodoverride.rb:24:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/flash.rb:182:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/cookies.rb:287:in `call'
activerecord (3.0.0) lib/active_record/query_cache.rb:32:in `call'
activerecord (3.0.0) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
activerecord (3.0.0) lib/active_record/query_cache.rb:12:in `cache'
activerecord (3.0.0) lib/active_record/query_cache.rb:31:in `call'
activerecord (3.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:355:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/callbacks.rb:46:in `call'
activesupport (3.0.0) lib/active_support/callbacks.rb:415:in `_run_call_callbacks'
actionpack (3.0.0) lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.1) lib/rack/sendfile.rb:107:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/show_exceptions.rb:46:in `call'
railties (3.0.0) lib/rails/rack/logger.rb:13:in `call'
rack (1.2.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.0.0) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.1) lib/rack/lock.rb:11:in `call'
rack (1.2.1) lib/rack/lock.rb:11:in `synchronize'
rack (1.2.1) lib/rack/lock.rb:11:in `call'
actionpack (3.0.0) lib/action_dispatch/middleware/static.rb:30:in `call'
railties (3.0.0) lib/rails/application.rb:168:in `call'
railties (3.0.0) lib/rails/application.rb:77:in `send'
railties (3.0.0) lib/rails/application.rb:77:in `method_missing'
railties (3.0.0) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.1) lib/rack/content_length.rb:13:in `call'
rack (1.2.1) lib/rack/handler/webrick.rb:52:in `service'
/opt/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/opt/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/opt/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/opt/local/lib/ruby/1.8/webrick/server.rb:162:in `start'
/opt/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/opt/local/lib/ruby/1.8/webrick/server.rb:95:in `start'
/opt/local/lib/ruby/1.8/webrick/server.rb:92:in `each'
/opt/local/lib/ruby/1.8/webrick/server.rb:92:in `start'
/opt/local/lib/ruby/1.8/webrick/server.rb:23:in `start'
/opt/local/lib/ruby/1.8/webrick/server.rb:82:in `start'
rack (1.2.1) lib/rack/handler/webrick.rb:13:in `run'
rack (1.2.1) lib/rack/server.rb:213:in `start'
railties (3.0.0) lib/rails/commands/server.rb:65:in `start'
railties (3.0.0) lib/rails/commands.rb:30
railties (3.0.0) lib/rails/commands.rb:27:in `tap'
railties (3.0.0) lib/rails/commands.rb:27
script/rails:6:in `require'
script/rails:6
Here is my view:
<% if can? :manage, article %>
<td><%= link_to 'Edit', edit_article_path(article) %></td>
<% end %>
<% if can? :manage, article %>
<td><%= link_to 'Delete', article, :method => :delete %></td>
<% end %>
Here is my controller:
def index
#articles = Article.find(:all)
end
Not sure exactly what your problem cause is without a trace, but I find I often have to check for nil when using a value, i.e. in your example:
can :manage, Article do |article|
article && article.user_id == user.id
end
it seems that in certain situations the block argument is nil
According to http://github.com/ryanb/cancan/wiki/defining-abilities-with-hashes there may be a cleaner way:
can :manage, Article, :user_id => user.id
I would try that method first, see how you go.