user2698988
user2698988

Reputation: 359

Action Could Not Be Found for Controller

Getting my way through a Ruby on Rails tutorial; I know this is very simple, but I'm stumped, as I'm very new to the framework here.

After generating a controller and mapping it appropriate in the .config log, and defining an action in my controller- I'm still receiving the same 'action error' within localhost:3000.

Here is what I am getting:

'Unknown Action'

'The action 'new' could not be found for PostsController'

Controller:

class PostsController < ApplicationController
end

def new
end

Can anyone shed some light on the issue?

Upvotes: 3

Views: 3469

Answers (2)

duhaime
duhaime

Reputation: 27611

Sweet lord I ended up here because my controller method was private (aka was listed below the private declaration in the controller).

Upvotes: 1

lawitschka
lawitschka

Reputation: 745

The controller class is closed before the new action is defined. Move the end in the second line behind your new action.

Upvotes: 7

Related Questions