'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?
Solution 1:[1]
The controller class is closed before the new action is defined. Move the end in the second line behind your new action.
Solution 2:[2]
Sweet lord I ended up here because my controller method was private (aka was listed below the private declaration in the controller).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | lawitschka |
| Solution 2 | duhaime |
