Reputation: 1267
I have a project where user can download files. Now, i want another page for show all users. so, i add a method all_users
in my addfiles_controller. I have also a view page all_users.html.erb
for that. But The ploblem is with the routes.rb file . Here I want to ensure user can only use :index, :new, :create, :destroy, :all_users
paths.
How can i set this :only helper in my routes.rb file, like
resources :addfiles, only: [:index, :new, :create, :destroy, :all_users]
My routes.rb file::
resources :addfiles do
collection do
get 'all_users'
end
end
Upvotes: 2
Views: 28
Reputation: 2165
you shouldn't write all_users
to only
, because only/except
related just to standard actions index, show, new, edit, create, update, destroy
which resources
define by default
resources :addfiles, only: [:index, :new, :create, :destroy] do
collection do
get 'all_users'
end
end
Upvotes: 1