I get a very opaque error with the following code:
client = OAuth2::Client.new(
"#{FACEBOOK_CONFIG['application_id']}", "#{FACEBOOK_CONFIG['secret_key']}",
:site => 'https://graph.facebook.com'
)
token = OAuth2::AccessToken.new(client, fb_token)
token.get('/me')
when I execute token.get('/me'), I get the following output:
OAuth2::Error Exception: OAuth2::Error
This code works fine with v0.4.1 but fails with v0.5.0
Here is the stack trace:
OAuth2::Error
Rails.root: /Users/myname/Sites/mysite
Application Trace | Framework Trace | Full Trace
oauth2 (0.5.0) lib/oauth2/client.rb:107:in `request'
oauth2 (0.5.0) lib/oauth2/access_token.rb:98:in `request'
oauth2 (0.5.0) lib/oauth2/access_token.rb:105:in `get'
app/models/facebook_session.rb:430:in `get_fb_me'
app/models/facebook_session.rb:45:in `get_fb_user_id'
app/models/facebook_session.rb:258:in `authenticate'
app/controllers/devise/registrations_controller.rb:42:in `create'
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:470:in `_run__664618575269127242__process_action__2116611615142804558__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:82: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'
warden (0.10.7) lib/warden/manager.rb:35:in `block in call'
warden (0.10.7) lib/warden/manager.rb:34:in `catch'
warden (0.10.7) lib/warden/manager.rb:34:in `call'
haml (3.0.25) lib/sass/plugin/rack.rb:41: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.3) 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'
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.3) 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.3) 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.3) lib/rack/lock.rb:11:in `block in call'
<internal:prelude>:10:in `synchronize'
rack (1.2.3) 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'
railties (3.0.3) lib/rails/rack/debugger.rb:21:in `call'
railties (3.0.3) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.3) lib/rack/content_length.rb:13:in `call'
rack (1.2.3) lib/rack/handler/webrick.rb:52:in `service'
/Users/myname/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
/Users/myname/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
/Users/myname/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
I've only used Omniauth recently but it looks like your trace is saying you have something like this in your oauth_helper:
def try_access_token
begin
..
rescue OAuth2::AccessDenied
end
end
If that's the case, try changing OAuth2::AccessDenied to OAuth2::Error. Oauth2::Error provides a .code attribute that you can check to determine if it's an access denied response.
4.1 docs: http://rubydoc.info/gems/oauth2/0.4.1/frames
5.0+ docs: http://rubydoc.info/gems/oauth2/0.5.0/frames
I have the same problem.
Looking at the gem code, it's because the Facebook answer is an HTTP code of 400..599.
when 400..599
e = Error.new(response)
raise e if opts[:raise_errors] || options[:raise_errors]
Sadly, the communication between my server to facebook is using HTTPS, therefore, I haven't been able to intercept the problematic request yet.
UPDATE
I got a 400 error from Facebook :
OAuth "Facebook Platform" "invalid_request" "An active access token must be used to query information about the current user."
UPDATE 2
Interesting discussion here : Facebook access_token invalid?
I ended up rolling oauth2 back to 0.4.1 and my FB login and querying works.
Related
I have created a rails app using
gem 'ckeditor'
gem 'carrierwave'
gem 'mini_magick'
Everything works fine. But when I try to upload an image in local server, it is not uploading and an error is created in rails server
NoMethodError (undefined method `size' for nil:NilClass):
mini_magick (3.7.0) lib/mini_magick.rb:24:in `choose_processor'
mini_magick (3.7.0) lib/mini_magick.rb:64:in `mogrify?'
mini_magick (3.7.0) lib/mini_magick/image.rb:360:in `run_command'
mini_magick (3.7.0) lib/mini_magick/image.rb:203:in `[]'
ckeditor (4.0.10) lib/ckeditor/backend/carrierwave.rb:57:in `read_dimensions'
carrierwave (0.9.0) lib/carrierwave/uploader/processing.rb:85:in `block in process!'
carrierwave (0.9.0) lib/carrierwave/uploader/processing.rb:81:in `each'
carrierwave (0.9.0) lib/carrierwave/uploader/processing.rb:81:in `process!'
carrierwave (0.9.0) lib/carrierwave/uploader/callbacks.rb:18:in `block in with_callbacks'
carrierwave (0.9.0) lib/carrierwave/uploader/callbacks.rb:18:in `each'
carrierwave (0.9.0) lib/carrierwave/uploader/callbacks.rb:18:in `with_callbacks'
carrierwave (0.9.0) lib/carrierwave/uploader/cache.rb:122:in `cache!'
carrierwave (0.9.0) lib/carrierwave/mount.rb:327:in `cache'
carrierwave (0.9.0) lib/carrierwave/mount.rb:179:in `data='
carrierwave (0.9.0) lib/carrierwave/orm/activerecord.rb:38:in `data='
ckeditor (4.0.10) app/controllers/ckeditor/application_controller.rb:13:in `respond_with_asset'
ckeditor (4.0.10) app/controllers/ckeditor/pictures_controller.rb:12:in `create'
actionpack (4.0.2) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.0.2) lib/abstract_controller/base.rb:189:in `process_action'
actionpack (4.0.2) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.0.2) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (4.0.2) lib/active_support/callbacks.rb:433:in `_run__908729428__process_action__callbacks'
activesupport (4.0.2) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.2) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (4.0.2) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.0.2) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
activesupport (4.0.2) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.0.2) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.0.2) lib/active_support/notifications.rb:159:in `instrument'
actionpack (4.0.2) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.0.2) lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
activerecord (4.0.2) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.0.2) lib/abstract_controller/base.rb:136:in `process'
actionpack (4.0.2) lib/abstract_controller/rendering.rb:44:in `process'
actionpack (4.0.2) lib/action_controller/metal.rb:195:in `dispatch'
actionpack (4.0.2) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.0.2) lib/action_controller/metal.rb:231:in `block in action'
actionpack (4.0.2) lib/action_dispatch/routing/route_set.rb:80:in `call'
actionpack (4.0.2) lib/action_dispatch/routing/route_set.rb:80:in `dispatch'
actionpack (4.0.2) lib/action_dispatch/routing/route_set.rb:48:in `call'
actionpack (4.0.2) lib/action_dispatch/journey/router.rb:71:in `block in call'
actionpack (4.0.2) lib/action_dispatch/journey/router.rb:59:in `each'
actionpack (4.0.2) lib/action_dispatch/journey/router.rb:59:in `call'
actionpack (4.0.2) lib/action_dispatch/routing/route_set.rb:680:in `call'
railties (4.0.2) lib/rails/engine.rb:511:in `call'
railties (4.0.2) lib/rails/railtie/configurable.rb:30:in `method_missing'
actionpack (4.0.2) lib/action_dispatch/journey/router.rb:71:in `block in call'
actionpack (4.0.2) lib/action_dispatch/journey/router.rb:59:in `each'
actionpack (4.0.2) lib/action_dispatch/journey/router.rb:59:in `call'
actionpack (4.0.2) lib/action_dispatch/routing/route_set.rb:680: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'
rack (1.5.2) lib/rack/etag.rb:23:in `call'
rack (1.5.2) lib/rack/conditionalget.rb:35:in `call'
rack (1.5.2) lib/rack/head.rb:11:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/flash.rb:241:in `call'
rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/cookies.rb:486:in `call'
activerecord (4.0.2) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.0.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
activerecord (4.0.2) lib/active_record/migration.rb:369:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.0.2) lib/active_support/callbacks.rb:373:in `_run__448849553__call__callbacks'
activesupport (4.0.2) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.2) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/reloader.rb:64:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.0.2) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.0.2) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.0.2) lib/active_support/tagged_logging.rb:67:in `block in tagged'
activesupport (4.0.2) lib/active_support/tagged_logging.rb:25:in `tagged'
activesupport (4.0.2) lib/active_support/tagged_logging.rb:67:in `tagged'
railties (4.0.2) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.0.2) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/static.rb:64:in `call'
rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
railties (4.0.2) lib/rails/engine.rb:511:in `call'
railties (4.0.2) lib/rails/application.rb:97:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
/home/shivakumaarmgs/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
/home/shivakumaarmgs/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
/home/shivakumaarmgs/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
I have the following mini_magick and carrierwave gems installed
/home/shivakumaarmgs/.rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/mini_magick-3.7.0
/home/shivakumaarmgs/.rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/carrierwave-0.9.0
What is the problem? Someone help..!!
I have also faced the same issue.
The problem is solved after I installed imagemagick
sudo apt-get install imagemagick
i am trying the PayPal REST API for Ruby on Rails, i am following the example "OAuth Request / Response" from https://developer.paypal.com/webapps/developer/docs/api/ for Ruby:
class PaymentsController < ApplicationController
include PayPal::SDK::REST
def pay
#api = PayPal::SDK::REST.set_config(
:ssl_options => {}, # Set ssl options
:mode => :sandbox, # Set :sandbox or :live
:client_id => "XXXXXXXXXXX",
:client_secret => "XXXXXXXXXXX" )
#api.token
end
end
And i don't know why, but i receive the next error.
LoadError in PaymentsController#pay
no such file to load -- {"scope":"openid https://api.paypal.com/v1/payments/.* https://api.paypal.com/v1/vault/credit-card/.* https://api.paypal.com/v1/vault/credit-card https://api.paypal.com/v1/developer/.*","access_token":"Mnlhn0RcJ9KWQTU6z5-cH5iDu8aeMzOM7TACw1NhFp0","token_type":"Bearer","app_id":"APP-80W284485P519543T","expires_in":28800}
full trace
activesupport (3.0.20) lib/active_support/dependencies.rb:236:in `load'
activesupport (3.0.20) lib/active_support/dependencies.rb:236:in `block in load'
activesupport (3.0.20) lib/active_support/dependencies.rb:225:in `block in load_dependency'
activesupport (3.0.20) lib/active_support/dependencies.rb:597:in `new_constants_in'
activesupport (3.0.20) lib/active_support/dependencies.rb:225:in `load_dependency'
activesupport (3.0.20) lib/active_support/dependencies.rb:236:in `load'
paypal-sdk-core (0.2.6) lib/paypal-sdk/core/api/rest.rb:58:in `token_hash'
paypal-sdk-core (0.2.6) lib/paypal-sdk/core/api/rest.rb:65:in `token'
app/controllers/payments_controller.rb:15:in `pay'
actionpack (3.0.20) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.0.20) lib/abstract_controller/base.rb:150:in `process_action'
actionpack (3.0.20) lib/action_controller/metal/rendering.rb:11:in `process_action'
actionpack (3.0.20) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.0.20) lib/active_support/callbacks.rb:456:in `_run__1063560453__process_action__391973748__callbacks'
activesupport (3.0.20) lib/active_support/callbacks.rb:410:in `_run_process_action_callbacks'
activesupport (3.0.20) lib/active_support/callbacks.rb:94:in `run_callbacks'
actionpack (3.0.20) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.0.20) lib/action_controller/metal/rescue.rb:17:in `process_action'
actionpack (3.0.20) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.0.20) lib/active_support/notifications.rb:52:in `block in instrument'
activesupport (3.0.20) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.20) lib/active_support/notifications.rb:52:in `instrument'
actionpack (3.0.20) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
newrelic_rpm (3.5.6.55) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:34:in `block in process_action'
newrelic_rpm (3.5.6.55) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:268:in `block in perform_action_with_newrelic_trace'
newrelic_rpm (3.5.6.55) lib/new_relic/agent/method_tracer.rb:240:in `trace_execution_scoped'
newrelic_rpm (3.5.6.55) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:263:in `perform_action_with_newrelic_trace'
newrelic_rpm (3.5.6.55) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:33:in `process_action'
actionpack (3.0.20) lib/abstract_controller/base.rb:119:in `process'
actionpack (3.0.20) lib/abstract_controller/rendering.rb:41:in `process'
actionpack (3.0.20) lib/action_controller/metal.rb:138:in `dispatch'
actionpack (3.0.20) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.0.20) lib/action_controller/metal.rb:178:in `block in action'
actionpack (3.0.20) lib/action_dispatch/routing/route_set.rb:68:in `call'
actionpack (3.0.20) lib/action_dispatch/routing/route_set.rb:68:in `dispatch'
actionpack (3.0.20) lib/action_dispatch/routing/route_set.rb:33: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:68: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.20) lib/action_dispatch/routing/route_set.rb:499:in `call'
oink (0.9.3) lib/oink/middleware.rb:17:in `call'
newrelic_rpm (3.5.6.55) lib/new_relic/rack/error_collector.rb:8:in `call'
newrelic_rpm (3.5.6.55) lib/new_relic/rack/agent_hooks.rb:14:in `call'
newrelic_rpm (3.5.6.55) lib/new_relic/rack/browser_monitoring.rb:12:in `call'
newrelic_rpm (3.5.6.55) lib/new_relic/rack/developer_mode.rb:24:in `call'
warden (1.0.6) lib/warden/manager.rb:35:in `block in call'
warden (1.0.6) lib/warden/manager.rb:34:in `catch'
warden (1.0.6) lib/warden/manager.rb:34:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/head.rb:14:in `call'
rack (1.2.7) lib/rack/methodoverride.rb:24:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/flash.rb:182:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/cookies.rb:302:in `call'
activerecord (3.0.20) lib/active_record/query_cache.rb:32:in `block in call'
activerecord (3.0.20) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
activerecord (3.0.20) lib/active_record/query_cache.rb:12:in `cache'
activerecord (3.0.20) lib/active_record/query_cache.rb:31:in `call'
activerecord (3.0.20) lib/active_record/connection_adapters/abstract/connection_pool.rb:354:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/callbacks.rb:46:in `block in call'
activesupport (3.0.20) lib/active_support/callbacks.rb:416:in `_run_call_callbacks'
actionpack (3.0.20) lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.7) lib/rack/sendfile.rb:106:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
railties (3.0.20) lib/rails/rack/logger.rb:13:in `call'
rack (1.2.7) lib/rack/runtime.rb:17:in `call'
activesupport (3.0.20) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.7) lib/rack/lock.rb:13:in `block in call'
<internal:prelude>:10:in `synchronize'
rack (1.2.7) lib/rack/lock.rb:13:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/static.rb:30:in `call'
airbrake (3.1.6) lib/airbrake/rack.rb:41:in `call'
airbrake (3.1.6) lib/airbrake/user_informer.rb:12:in `call'
railties (3.0.20) lib/rails/application.rb:168:in `call'
railties (3.0.20) lib/rails/application.rb:77:in `method_missing'
railties (3.0.20) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.7) lib/rack/content_length.rb:13:in `call'
rack (1.2.7) lib/rack/handler/webrick.rb:52:in `service'
/home/jorge/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
/home/jorge/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
/home/jorge/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
This error occurred while loading the following files:
{"scope":"openid https://api.paypal.com/v1/payments/.* https://api.paypal.com/v1/vault/credit-card/.* https://api.paypal.com/v1/vault/credit-card https://api.paypal.com/v1/developer/.*","access_token":"Mnlhn0RcJ9KWQTU6z5-cH5iDu8aeMzOM7TACw1NhFp0","token_type":"Bearer","app_id":"APP-80W284485P519543T","expires_in":28800}
SOLVED: update the multi_json gem to last version.
update the multi_json gem to last version.
I have a rails app that is is using cancan permission and i am trying to block others users from editing another user's dashboard. This has worked for other models but not this one.
profile.rb
belongs_to :dashboard
Dashboard.rb
has_many :profiles
Dashboard_controller
before_filter :authenticate_user!
load_and_authorize_resource :through => :current_profile
Ability.rb
can :manage, Dashboard, :profile => { :user_id => user.id }
When I go to view my dashboard rails gives me the error
undefined method `dashboards'
Any ideas how I can overcome this error?
Full trace
activemodel (3.1.3) lib/active_model/attribute_methods.rb:385:in `method_missing'
activerecord (3.1.3) lib/active_record/attribute_methods.rb:60:in `method_missing'
cancan (1.6.7) lib/cancan/controller_resource.rb:174:in `resource_base'
cancan (1.6.7) lib/cancan/controller_resource.rb:77:in `load_collection?'
cancan (1.6.7) lib/cancan/controller_resource.rb:33:in `load_resource'
cancan (1.6.7) lib/cancan/controller_resource.rb:25:in `load_and_authorize_resource'
cancan (1.6.7) lib/cancan/controller_resource.rb:10:in `block in add_before_filter'
activesupport (3.1.3) lib/active_support/callbacks.rb:439:in `_run__4465164984821190291__process_action__669795061578511304__callbacks'
activesupport (3.1.3) lib/active_support/callbacks.rb:386:in `_run_process_action_callbacks'
activesupport (3.1.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.1.3) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.1.3) lib/action_controller/metal/rescue.rb:17:in `process_action'
actionpack (3.1.3) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.1.3) lib/active_support/notifications.rb:53:in `block in instrument'
activesupport (3.1.3) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.1.3) lib/active_support/notifications.rb:53:in `instrument'
actionpack (3.1.3) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.1.3) lib/action_controller/metal/params_wrapper.rb:201:in `process_action'
activerecord (3.1.3) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.1.3) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.1.3) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.1.3) lib/action_controller/metal.rb:193:in `dispatch'
actionpack (3.1.3) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.1.3) lib/action_controller/metal.rb:236:in `block in action'
actionpack (3.1.3) lib/action_dispatch/routing/route_set.rb:65:in `call'
actionpack (3.1.3) lib/action_dispatch/routing/route_set.rb:65:in `dispatch'
actionpack (3.1.3) lib/action_dispatch/routing/route_set.rb:29:in `call'
rack-mount (0.8.3) lib/rack/mount/route_set.rb:152:in `block in call'
rack-mount (0.8.3) lib/rack/mount/code_generation.rb:96:in `block in recognize'
rack-mount (0.8.3) lib/rack/mount/code_generation.rb:75:in `optimized_each'
rack-mount (0.8.3) lib/rack/mount/code_generation.rb:95:in `recognize'
rack-mount (0.8.3) lib/rack/mount/route_set.rb:141:in `call'
actionpack (3.1.3) lib/action_dispatch/routing/route_set.rb:532:in `call'
warden (1.1.0) lib/warden/manager.rb:35:in `block in call'
warden (1.1.0) lib/warden/manager.rb:34:in `catch'
warden (1.1.0) lib/warden/manager.rb:34:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.3.6) lib/rack/etag.rb:23:in `call'
rack (1.3.6) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/flash.rb:247:in `call'
rack (1.3.6) lib/rack/session/abstract/id.rb:195:in `context'
rack (1.3.6) lib/rack/session/abstract/id.rb:190:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/cookies.rb:331:in `call'
activerecord (3.1.3) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.1.3) lib/active_record/connection_adapters/abstract/connection_pool.rb:477:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (3.1.3) lib/active_support/callbacks.rb:392:in `_run_call_callbacks'
activesupport (3.1.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.1.3) lib/action_dispatch/middleware/callbacks.rb:28:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/reloader.rb:68:in `call'
rack (1.3.6) lib/rack/sendfile.rb:101:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
railties (3.1.3) lib/rails/rack/logger.rb:13:in `call'
rack (1.3.6) lib/rack/methodoverride.rb:24:in `call'
rack (1.3.6) lib/rack/runtime.rb:17:in `call'
activesupport (3.1.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.3.6) lib/rack/lock.rb:15:in `call'
actionpack (3.1.3) lib/action_dispatch/middleware/static.rb:53:in `call'
railties (3.1.3) lib/rails/engine.rb:456:in `call'
rack (1.3.6) lib/rack/content_length.rb:14:in `call'
railties (3.1.3) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.3.6) lib/rack/handler/webrick.rb:59:in `service'
/Users/mac/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
/Users/mac/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
/Users/mac/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
When you use load_authorize_resource Cancan assumes a plural resource (ie that a profile has many dashboards). According to the docs adding :singleton => true turns this off
I am using devise 1.3.4 on Rails 3.0.3 and ruby 1.8.7 for user authentication/authorization and new user creation. (I followed Ryan's railscast on devise and omniauth but also used the confirmable option)
It works just fine when there are no users in the database. However, when I signout the only user and try to create a new one, I get the following error:
undefined method `encode!' for "Confirmation":String
Here's the full stack trace:
ail (2.2.17) lib/mail/fields/unstructured_field.rb:169:in `encode'
mail (2.2.17) lib/mail/fields/unstructured_field.rb:138:in `fold'
mail (2.2.17) lib/mail/fields/unstructured_field.rb:108:in `wrapped_value'
mail (2.2.17) lib/mail/fields/unstructured_field.rb:70:in `do_encode'
mail (2.2.17) lib/mail/fields/unstructured_field.rb:52:in `encoded'
mail (2.2.17) lib/mail/field.rb:122:in `send'
mail (2.2.17) lib/mail/field.rb:122:in `method_missing'
mail (2.2.17) lib/mail/header.rb:190:in `encoded'
mail (2.2.17) lib/mail/header.rb:189:in `each'
mail (2.2.17) lib/mail/header.rb:189:in `encoded'
mail (2.2.17) lib/mail/message.rb:1707:in `encoded'
actionmailer (3.0.3) lib/action_mailer/base.rb:420:in `set_payload_for_mail'
actionmailer (3.0.3) lib/action_mailer/base.rb:400:in `deliver_mail'
activesupport (3.0.3) lib/active_support/notifications.rb:52: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'
actionmailer (3.0.3) lib/action_mailer/base.rb:399:in `deliver_mail'
mail (2.2.17) lib/mail/message.rb:230:in `deliver'
devise (1.3.4) lib/devise/models/confirmable.rb:50:in `send_confirmation_instructions'
activesupport (3.0.3) lib/active_support/callbacks.rb:425:in `_run_create_callbacks'
activerecord (3.0.3) lib/active_record/callbacks.rb:281:in `create'
activerecord (3.0.3) lib/active_record/persistence.rb:246:in `create_or_update'
activerecord (3.0.3) lib/active_record/callbacks.rb:277:in `create_or_update'
activesupport (3.0.3) lib/active_support/callbacks.rb:418:in `_run_save_callbacks'
activerecord (3.0.3) lib/active_record/callbacks.rb:277:in `create_or_update'
activerecord (3.0.3) lib/active_record/persistence.rb:39:in `save'
activerecord (3.0.3) lib/active_record/validations.rb:43:in `save'
activerecord (3.0.3) lib/active_record/attribute_methods/dirty.rb:21:in `save'
activerecord (3.0.3) lib/active_record/transactions.rb:237:in `save'
activerecord (3.0.3) lib/active_record/transactions.rb:289:in `with_transaction_returning_status'
activerecord (3.0.3) lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction'
activerecord (3.0.3) lib/active_record/transactions.rb:204:in `transaction'
activerecord (3.0.3) lib/active_record/transactions.rb:287:in `with_transaction_returning_status'
activerecord (3.0.3) lib/active_record/transactions.rb:237:in `save'
activerecord (3.0.3) lib/active_record/transactions.rb:248:in `rollback_active_record_state!'
activerecord (3.0.3) lib/active_record/transactions.rb:236:in `save'
devise (1.3.4) app/controllers/devise/registrations_controller.rb:16:in `create'
app/controllers/registrations_controller.rb:3:in `create'
actionpack (3.0.3) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
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 `process_action'
activesupport (3.0.3) lib/active_support/callbacks.rb:445:in `_run__799082383__process_action__1623385099__callbacks'
activesupport (3.0.3) lib/active_support/callbacks.rb:409:in `send'
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 `send'
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 `process_action'
activesupport (3.0.3) lib/active_support/notifications.rb:52: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 `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'
actionpack (3.0.3) lib/action_dispatch/routing/mapper.rb:35:in `call'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:148:in `call'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:93:in `recognize'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:89: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.4) lib/omniauth/strategy.rb:59:in `call!'
oa-core (0.2.4) lib/omniauth/strategy.rb:26:in `call'
oa-core (0.2.4) lib/omniauth/strategy.rb:59:in `call!'
oa-core (0.2.4) lib/omniauth/strategy.rb:26:in `call'
oa-core (0.2.4) lib/omniauth/strategy.rb:59:in `call!'
oa-core (0.2.4) lib/omniauth/strategy.rb:26:in `call'
oa-core (0.2.4) lib/omniauth/builder.rb:30:in `call'
warden (1.0.4) lib/warden/manager.rb:35:in `call'
warden (1.0.4) lib/warden/manager.rb:34:in `catch'
warden (1.0.4) 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'
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 `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 `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 `call'
rack (1.2.2) lib/rack/lock.rb:11: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 `send'
railties (3.0.3) lib/rails/application.rb:77:in `method_missing'
railties (3.0.3) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.2) lib/rack/content_length.rb:13:in `call'
rack (1.2.2) lib/rack/handler/webrick.rb:52:in `service'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:162:in `start'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:95:in `start'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:92:in `each'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:92:in `start'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:23:in `start'
/Users/rahulbaxi/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/webrick/server.rb:82:in `start'
rack (1.2.2) lib/rack/handler/webrick.rb:13:in `run'
rack (1.2.2) lib/rack/server.rb:213:in `start'
railties (3.0.3) lib/rails/commands/server.rb:65:in `start'
railties (3.0.3) lib/rails/commands.rb:30
railties (3.0.3) lib/rails/commands.rb:27:in `tap'
railties (3.0.3) lib/rails/commands.rb:27
script/rails:6:in `require'
script/rails:6
Please help me out with this!
String#encode! is new in Ruby 1.9 so its just not there in 1.8.7. So it looks as though the mail gem that you are using has a dependency on 1.9.
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/}