i'm using rails 4.0
in routes.rb have code
get "test/index"
it works fine. when add custom route like:
post "test/some_controller_action"
and send file via curl
curl -x post -h "content-type: application/json" -d @result.json http://localhost:3000/test/some_controller_action
i error
started post "/test/some_controller_action" 127.0.0.1 @ 2013-07-15 14:28:11 +0700 actioncontroller::routingerror (no route matches [post] "/test/some_controller_action"): actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call' actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app' railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call' activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged' activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged' activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged' railties (4.0.0) lib/rails/rack/logger.rb:21:in `call' actionpack (4.0.0) 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.0) 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.0) lib/action_dispatch/middleware/static.rb:64:in `call' railties (4.0.0) lib/rails/engine.rb:511:in `call' railties (4.0.0) 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'
rake routes:
prefix verb uri pattern controller#action test_index /test/index(.:format) test#index test_some_controller_action post /test/some_controller_action(.:format) test#some_controller_action
what wrong route?
try adding routes , see routes running rake routes
match '/test/some_controller_action' => 'test#some_controller_action', :via => :post, :as => :some_controller_action
Comments
Post a Comment