charliez
charliez

Reputation: 163

Unknown action: The action could not be found for Controller

This has been driving me nuts for a whole day. I have the following in my ccpayment controller:

#"ccpayments.rb"

  def checkout
    raise ActionController::RoutingError.new('No invoice found with that invoice code')
  end

The raise error bit is for testing only... I removed the content to be sure I wasn't messing up something there.

Then in my routes I have

  scope "/:locale" do
    resources :jurisdictions, :except => ['show']
    resources :ccpayments do
      collection do
        get "checkout"
      end
    end
  end

A rake routes show

checkout_ccpayments GET  /:locale/ccpayments/checkout(.:format) ccpayments#checkout

However, when running this on ...:3000/en/ccpayments/checkout I get

Unknown action The action 'checkout' could not be found for CcpaymentsController

If I add a view it will show the view, but the action is never called. I am sure I am missing something basic as I am a rails novice, but what? Any help appreciated!

Upvotes: 0

Views: 2705

Answers (1)

jvperrin
jvperrin

Reputation: 3368

You said that your controller file is named ccpayments.rb but the standard naming system for controllers would make it ccpayments_controller.rb, so that would cause a action not found error. Try renaming your controller file and see if this fixes the problem.

Upvotes: 3

Related Questions