Unknown action. No action received.

I created a User model using scaffolding


script/generate scaffold user username:string crypted_password:string email:string active:boolean perishable_token:string persistance_token:string

Then I added a method to UserController


def test
end

And then created a view file test.html.erb and I print "Hello"

So now I'm trying to access localhost: 3000 / users / test

He gives this error


Unknown action
No action responded to show. Actions:...

On my routes .rb I have


map.resources :users

when I see that the development log takes the parameter "test" as "id", where as its action.

any help?

+3
source share
1 answer

You need to define an additional action, see http://guides.rubyonrails.org/routing.html#adding-more-restful-actions to change the route to

map.resources :users, :collection => { :test => :get }

rake routes - btw , Rails 2.3.x, ?

+4

Source: https://habr.com/ru/post/1758428/


All Articles