I developed a normal (Post) like rails application that has features of posting articles with pictures then I opted for active admin in regulating the post as in (admin user), so the application doesnt have any other user expect the admin that will regulate post at backend, how do I restrict these admin routes page like if a normal web visitor attempts to visit the routes it wont be accessible ?
new_admin_user_session GET /admin/login(.:format) active_admin/devise/sessions#new
admin_user_session POST /admin/login(.:format) active_admin/devise/sessions#create
destroy_admin_user_session DELETE|GET /admin/logout(.:format) active_admin/devise/sessions#destroy
new_admin_user_password GET /admin/password/new(.:format) active_admin/devise/passwords#new
edit_admin_user_password GET /admin/password/edit(.:format) active_admin/devise/passwords#edit
admin_user_password PATCH /admin/password(.:format) active_admin/devise/passwords#update
PUT /admin/password(.:format) active_admin/devise/passwords#update
POST /admin/password(.:format) active_admin/devise/passwords#create
admin_root GET /admin(.:format) admin/dashboard#index
batch_action_admin_admin_users POST /admin/admin_users/batch_action(.:format) admin/admin_users#batch_action
admin_admin_users GET /admin/admin_users(.:format) admin/admin_users#index
POST /admin/admin_users(.:format) admin/admin_users#create
new_admin_admin_user GET /admin/admin_users/new(.:format) admin/admin_users#new
edit_admin_admin_user GET /admin/admin_users/:id/edit(.:format) admin/admin_users#edit
admin_admin_user GET /admin/admin_users/:id(.:format) admin/admin_users#show
PATCH /admin/admin_users/:id(.:format) admin/admin_users#update
PUT /admin/admin_users/:id(.:format) admin/admin_users#update
DELETE /admin/admin_users/:id(.:format) admin/admin_users#destroy
batch_action_admin_articles POST /admin/articles/batch_action(.:format) admin/articles#batch_action
admin_articles GET /admin/articles(.:format) admin/articles#index
POST /admin/articles(.:format) admin/articles#create
new_admin_article GET /admin/articles/new(.:format) admin/articles#new
edit_admin_article GET /admin/articles/:id/edit(.:format) admin/articles#edit
admin_article GET /admin/articles/:id(.:format) admin/articles#show
PATCH /admin/articles/:id(.:format) admin/articles#update
PUT /admin/articles/:id(.:format) admin/articles#update
DELETE /admin/articles/:id(.:format) admin/articles#destroy
admin_dashboard GET /admin/dashboard(.:format) admin/dashboard#index
admin_comments GET /admin/comments(.:format) admin/comments#index
POST /admin/comments(.:format) admin/comments#create
admin_c
the only way i have seen is by integrating an authorization system in AA, here is the link:
https://activeadmin.info/13-authorization-adapter.html#managing-access-to-pages
Related
How do you implement an authentication system using OAUTH with the devise_token_auth gem?
I have searched pretty much everywhere on the internet, including all the documentation in https://github.com/lynndylanhurley/devise_token_auth repo and searched in all it's issues.
I am developing an API to handle user SIGN UP and LOG IN through social networks but I can't find a way to make this work with this gem.
PROBLEM
def social_login
uri = URI('http://localhost:3000/auth/facebook')
response = Net::HTTP.get_response(uri)
puts response.body
redirect_to :back
end
this method for testing the API (localhost:3000) gives me this response:
<html><body>You are being redirected.</body></html>
My Facebook callback URL:
http://localhost:4000/auth/facebook/callback
Client tester: localhost:4000
My API routes:
Prefix Verb URI Pattern Controller#Action
new_user_session GET /auth/sign_in(.:format) devise_token_auth/sessions#new
user_session POST /auth/sign_in(.:format) devise_token_auth/sessions#create
destroy_user_session DELETE /auth/sign_out(.:format) devise_token_auth/sessions#destroy
user_password POST /auth/password(.:format) devise_token_auth/passwords#create
new_user_password GET /auth/password/new(.:format) devise_token_auth/passwords#new
edit_user_password GET /auth/password/edit(.:format) devise_token_auth/passwords#edit
PATCH /auth/password(.:format) devise_token_auth/passwords#update
PUT /auth/password(.:format) devise_token_auth/passwords#update
cancel_user_registration GET /auth/cancel(.:format) devise_token_auth/registrations#cancel
user_registration POST /auth(.:format) devise_token_auth/registrations#create
new_user_registration GET /auth/sign_up(.:format) devise_token_auth/registrations#new
edit_user_registration GET /auth/edit(.:format) devise_token_auth/registrations#edit
PATCH /auth(.:format) devise_token_auth/registrations#update
PUT /auth(.:format) devise_token_auth/registrations#update
DELETE /auth(.:format) devise_token_auth/registrations#destroy
auth_validate_token GET /auth/validate_token(.:format) devise_token_auth/token_validations#validate_token
auth_failure GET /auth/failure(.:format) devise_token_auth/omniauth_callbacks#omniauth_failure
GET /auth/:provider/callback(.:format) devise_token_auth/omniauth_callbacks#omniauth_success
GET /omniauth/:provider/callback(.:format) devise_token_auth/omniauth_callbacks#redirect_callbacks
omniauth_failure GET /omniauth/failure(.:format) devise_token_auth/omniauth_callbacks#omniauth_failure
GET /auth/:provider(.:format) redirect(301)
You'll have to use Omniauth https://github.com/intridea/omniauth and make integration with devise_token_auth they've explained in the documentation https://github.com/lynndylanhurley/devise_token_auth#omniauth-authentication
I'm trying to create a collection_action in ActiveAdmin which allows me to rearrange the position after a drop and add. I want to be able to drag and drop the list in the index and have the new positions sent via Ajax through a post request
This is what I have so far:
ActiveAdmin.register Subscriber do
collection_action :reorder, :method => :post do
end
controller do
def reorder
#item = ResponsiveWeb.find(params[:id])
#item.position = params[:position]
#item.saved
render nothing: true
end
private
def item_params
params.require(:responsive_web).permit(:id, :position)
end
end
These are the routes:
Prefix Verb URI Pattern Controller#Action
new_admin_user_session GET /admin/login(.:format) active_admin/devise/sessions#new
admin_user_session POST /admin/login(.:format) active_admin/devise/sessions#create
destroy_admin_user_session DELETE|GET /admin/logout(.:format) active_admin/devise/sessions#destroy
admin_user_password POST /admin/password(.:format) active_admin/devise/passwords#create
new_admin_user_password GET /admin/password/new(.:format) active_admin/devise/passwords#new
edit_admin_user_password GET /admin/password/edit(.:format) active_admin/devise/passwords#edit
PATCH /admin/password(.:format) active_admin/devise/passwords#update
PUT /admin/password(.:format) active_admin/devise/passwords#update
admin_root GET /admin(.:format) admin/dashboard#index
batch_action_admin_admin_users POST /admin/admin_users/batch_action(.:format) admin/admin_users#batch_action
admin_admin_users GET /admin/admin_users(.:format) admin/admin_users#index
POST /admin/admin_users(.:format) admin/admin_users#create
new_admin_admin_user GET /admin/admin_users/new(.:format) admin/admin_users#new
edit_admin_admin_user GET /admin/admin_users/:id/edit(.:format) admin/admin_users#edit
admin_admin_user PATCH /admin/admin_users/:id(.:format) admin/admin_users#update
PUT /admin/admin_users/:id(.:format) admin/admin_users#update
DELETE /admin/admin_users/:id(.:format) admin/admin_users#destroy
admin_dashboard GET /admin/dashboard(.:format) admin/dashboard#index
sort_admin_responsive_web POST /admin/responsive_webs/:id/sort(.:format) admin/responsive_webs#sort
reorder_admin_responsive_webs POST /admin/responsive_webs/reorder(.:format) admin/responsive_webs#reorder
However when I reorder I get the 404 not found error and when I check the error logs it says, Couldn't find ResponsiveWeb with id=reorder.
Any help will be greatly appreciated!
To declare a collection action, active admin provide another dsl. Here is an example. You can try that.
collection_action :reorder, method: :post do
# your resources or whatever you need
end
One thing, active admin resource DSL provide a permit_params, so you don't need to declare it on your controller.
Hope this answer helps.
Here is the reference:
http://activeadmin.info/docs/8-custom-actions.html
I follow the tutorial of active_admin at this url: activeadmin
I tried to add it to a project that already exists followings this differents steps:
Add it to my Gemfile gem 'activeadmin', github: 'activeadmin'
Run the follow command because i already install devise rails g active_admin:install --skip-users
And rake db:migrate && rails server
My problem is that when i want to access to localhost:3000/admin i get this error Unknown Action AbstractController::ActionNotFound
Here is my routes.rb
Rails.application.routes.draw do
config = ActiveAdmin::Devise.config
config[:controllers][:sessions] = 'sessions'
config[:controllers][:registrations] = 'registrations'
config[:as] = 'admin'
devise_for :users, config
# Login / Logout routes
namespace :v1, path: '/' do
devise_scope :user do
post '/sessions', to: 'sessions#create'
post '/registrations', to: 'registrations#create'
delete '/sessions', to: 'sessions#destroy'
end
# User routes
get '/user', to: 'users#show'
patch '/user/update', to: 'users#update'
end
ActiveAdmin.routes(self)
end
I'm using rails 4.2.1 and ruby 2.2.2
UPDATE 09/06
rake routes
new_admin_user_session GET /admin/login(.:format) sessions#new
admin_user_session POST /admin/login(.:format) sessions#create
destroy_admin_user_session DELETE|GET /admin/logout(.:format) sessions#destroy
admin_user_password POST /admin/password(.:format) active_admin/devise/passwords#create
new_admin_user_password GET /admin/password/new(.:format) active_admin/devise/passwords#new
edit_admin_user_password GET /admin/password/edit(.:format) active_admin/devise/passwords#edit
PATCH /admin/password(.:format) active_admin/devise/passwords#update
PUT /admin/password(.:format) active_admin/devise/passwords#update
cancel_admin_user_registration GET /admin/cancel(.:format) registrations#cancel
admin_user_registration POST /admin(.:format) registrations#create
new_admin_user_registration GET /admin/sign_up(.:format) registrations#new
edit_admin_user_registration GET /admin/edit(.:format) registrations#edit
PATCH /admin(.:format) registrations#update
PUT /admin(.:format) registrations#update
DELETE /admin(.:format) registrations#destroy
v1_sessions POST /sessions(.:format) v1/sessions#create
v1_registrations POST /registrations(.:format) v1/registrations#create
DELETE /sessions(.:format) v1/sessions#destroy
v1_user GET /user(.:format) v1/users#show
v1_user_update PATCH /user/update(.:format) v1/users#update
admin_root GET /admin(.:format) admin/dashboard#index
admin_dashboard GET /admin/dashboard(.:format) admin/dashboard#index
batch_action_admin_admin_users POST /admin/admin_users/batch_action(.:format) admin/admin_users#batch_action
admin_admin_users GET /admin/admin_users(.:format) admin/admin_users#index
POST /admin/admin_users(.:format) admin/admin_users#create
new_admin_admin_user GET /admin/admin_users/new(.:format) admin/admin_users#new
edit_admin_admin_user GET /admin/admin_users/:id/edit(.:format) admin/admin_users#edit
admin_admin_user GET /admin/admin_users/:id(.:format) admin/admin_users#show
PATCH /admin/admin_users/:id(.:format) admin/admin_users#update
PUT /admin/admin_users/:id(.:format) admin/admin_users#update
DELETE /admin/admin_users/:id(.:format) admin/admin_users#destroy
admin_comments GET /admin/comments(.:format) admin/comments#index
POST /admin/comments(.:format) admin/comments#create
admin_comment GET /admin/comments/:id(.:format) admin/comments#show
and the log
F, [2015-06-09T10:45:02.609120 #2451] FATAL -- :
AbstractController::ActionNotFound (AbstractController::ActionNotFound):
/home/snoobie/.rvm/gems/ruby-2.2.2/bundler/gems/activeadmin-0b4b22871fd3/lib/active_admin/base_controller.rb:29:in `only_render_implemented_actions'
I hope someone can explain me what i'm doing wrong.
Thank you !
I solved it by using rails_admin, more easly to agregate to the project. If someone need more informations about the process to add rails_admin in rails project. Please let a comment and i will explain it in details.
I'm new to Ruby on Rails and I'm working on an application that contains form used to create a new nominee ( store it in the database)
I get the problem with this instruction of the form:
<%= form_for :subscription, :url => {:controller => "subscriptions", :action => "create"} do |f| %>
this is the error:
Routing Error
No route matches [POST] "/subscriptions/create"
rake routes
Prefix Verb URI Pattern Controller#Action
subscriptions_create GET /subscriptions/create(.:format) subscriptions#create
subscriptions_index GET /subscriptions/index(.:format) subscriptions#index
articles_index GET /articles/index(.:format) articles#index
new_admin_user_session GET /admin/login(.:format) active_admin/devise/sessions#new
admin_user_session POST /admin/login(.:format) active_admin/devise/sessions#create
destroy_admin_user_session DELETE|GET /admin/logout(.:format) active_admin/devise/sessions#destroy
admin_user_password POST /admin/password(.:format) active_admin/devise/passwords#create
new_admin_user_password GET /admin/password/new(.:format) active_admin/devise/passwords#new
edit_admin_user_password GET /admin/password/edit(.:format) active_admin/devise/passwords#edit
PATCH /admin/password(.:format) active_admin/devise/passwords#update
PUT /admin/password(.:format) active_admin/devise/passwords#update
admin_root GET /admin(.:format) admin/dashboard#index
batch_action_admin_admin_users POST /admin/admin_users/batch_action(.:format) admin/admin_users#batch_action
admin_admin_users GET /admin/admin_users(.:format) admin/admin_users#index
POST /admin/admin_users(.:format) admin/admin_users#create
new_admin_admin_user GET /admin/admin_users/new(.:format) admin/admin_users#new
edit_admin_admin_user GET /admin/admin_users/:id/edit(.:format) admin/admin_users#edit
admin_admin_user GET /admin/admin_users/:id(.:format) admin/admin_users#show
PATCH /admin/admin_users/:id(.:format) admin/admin_users#update
PUT /admin/admin_users/:id(.:format) admin/admin_users#update
DELETE /admin/admin_users/:id(.:format) admin/admin_users#destroy
batch_action_admin_contacts POST /admin/contacts/batch_action(.:format) admin/contacts#batch_action
admin_contacts GET /admin/contacts(.:format) admin/contacts#index
POST /admin/contacts(.:format) admin/contacts#create
new_admin_contact GET /admin/contacts/new(.:format) admin/contacts#new
edit_admin_contact GET /admin/contacts/:id/edit(.:format) admin/contacts#edit
admin_contact GET /admin/contacts/:id(.:format) admin/contacts#show
PATCH /admin/contacts/:id(.:format) admin/contacts#update
PUT /admin/contacts/:id(.:format) admin/contacts#update
DELETE /admin/contacts/:id(.:format) admin/contacts#destroy
admin_dashboard GET /admin/dashboard(.:format) admin/dashboard#index
admin_comments GET /admin/comments(.:format) admin/comments#index
POST /admin/comments(.:format) admin/comments#create
admin_comment GET /admin/comments/:id(.:format) admin/comments#show
articles GET /articles(.:format) articles#index
POST /articles(.:format) articles#create
new_article GET /articles/new(.:format) articles#new
edit_article GET /articles/:id/edit(.:format) articles#edit
article GET /articles/:id(.:format) articles#show
PATCH /articles/:id(.:format) articles#update
PUT /articles/:id(.:format) articles#update
DELETE /articles/:id(.:format) articles#destroy
welcome_sponsor GET /welcome/sponsor(.:format) welcome#sponsor
welcome_photo GET /welcome/photo(.:format) welcome#photo
welcome_index GET /welcome/index(.:format) welcome#index
root GET / welcome#index
best regard
As you can see from the lines below:
Prefix Verb URI Pattern Controller#Action
subscriptions_create GET /subscriptions/create(.:format) subscriptions#create
you have got a route for subscriptions_create but it needs to be POST instead of GET. Simply update this route in your routes.rb file in your config folder to be a POST instead of a GET.
As you can see from this line
subscriptions_create GET /subscriptions/create(.:format), that route is only available when using GET HTTP method.
You need to change your routes.rb file for subscriptions to accept POST instead of GET. The easiest way would be to add resources :subscriptions, which will add all standard CRUD routes for resource.
I have a problem: After starting server I got this error:
undefined local variable or method `prepodavatels_stats_path' for #<#:0x0000000461ec58> I presented rake routes in this post.
Error on the following line
<li><%= link_to "", prepodavatels_stats_path %><li>
routes.rb
resources :prepodavatels do
collection do
get 'stats'
end
resources :predmets
resources :ppdatas
end
rake routes
Prefix Verb URI Pattern Controller#Action
groups GET /groups(.:format) groups#index
POST /groups(.:format) groups#create
new_group GET /groups/new(.:format) groups#new
edit_group GET /groups/:id/edit(.:format) groups#edit
group GET /groups/:id(.:format) groups#show
PATCH /groups/:id(.:format) groups#update
PUT /groups/:id(.:format) groups#update
DELETE /groups/:id(.:format) groups#destroy
students_index2 GET /students/index2(.:format) students#index2
students_index3 GET /students/index3(.:format) students#index3
students_index4 GET /students/index4(.:format) students#index4
students_index5 GET /students/index5(.:format) students#index5
students_index6 GET /students/index6(.:format) students#index6
stats_students GET /students/stats(.:format) students#stats
students GET /students(.:format) students#index
POST /students(.:format) students#create
new_student GET /students/new(.:format) students#new
edit_student GET /students/:id/edit(.:format) students#edit
student GET /students/:id(.:format) students#show
PATCH /students/:id(.:format) students#update
PUT /students/:id(.:format) students#update
DELETE /students/:id(.:format) students#destroy
stats_prepodavatels GET /prepodavatels/stats(.:format) prepodavatels#stats
predmets GET /prepodavatels/predmets(.:format) predmets#index
POST /prepodavatels/predmets(.:format) predmets#create
new_predmet GET /prepodavatels/predmets/new(.:format) predmets#new
edit_predmet GET /prepodavatels/predmets/:id/edit(.:format) predmets#edit
predmet GET /prepodavatels/predmets/:id(.:format) predmets#show
PATCH /prepodavatels/predmets/:id(.:format) predmets#update
PUT /prepodavatels/predmets/:id(.:format) predmets#update
DELETE /prepodavatels/predmets/:id(.:format) predmets#destroy
ppdatas GET /prepodavatels/ppdatas(.:format) ppdatas#index
POST /prepodavatels/ppdatas(.:format) ppdatas#create
new_ppdata GET /prepodavatels/ppdatas/new(.:format) ppdatas#new
edit_ppdata GET /prepodavatels/ppdatas/:id/edit(.:format) ppdatas#edit
ppdata GET /prepodavatels/ppdatas/:id(.:format) ppdatas#show
PATCH /prepodavatels/ppdatas/:id(.:format) ppdatas#update
PUT /prepodavatels/ppdatas/:id(.:format) ppdatas#update
DELETE /prepodavatels/ppdatas/:id(.:format) ppdatas#destroy
prepodavatels GET /prepodavatels(.:format) prepodavatels#index
POST /prepodavatels(.:format) prepodavatels#create
new_prepodavatel GET /prepodavatels/new(.:format) prepodavatels#new
edit_prepodavatel GET /prepodavatels/:id/edit(.:format) prepodavatels#edit
prepodavatel GET /prepodavatels/:id(.:format) prepodavatels#show
PATCH /prepodavatels/:id(.:format) prepodavatels#update
PUT /prepodavatels/:id(.:format) prepodavatels#update
DELETE /prepodavatels/:id(.:format) prepodavatels#destroy
admin GET /admin(.:format) admin#index
admin_index GET /admin/index(.:format) admin#index
ppdatas_index GET /ppdatas/index(.:format) ppdatas#index
ppdatas_index2 GET /ppdatas/index2(.:format) ppdatas#index2
index2_year_courses PATCH /year_courses/index2(.:format) year_courses#index2
year_courses GET /year_courses(.:format) year_courses#index
POST /year_courses(.:format) year_courses#create
new_year_course GET /year_courses/new(.:format) year_courses#new
edit_year_course GET /year_courses/:id/edit(.:format) year_courses#edit
year_course GET /year_courses/:id(.:format) year_courses#show
PATCH /year_courses/:id(.:format) year_courses#update
PUT /year_courses/:id(.:format) year_courses#update
DELETE /year_courses/:id(.:format) year_courses#destroy
group_new GET /groups/:group_id/new(.:format) groups#new
group_show GET /groups/:group_id/show(.:format) groups#show
PATCH /groups/index(.:format) groups#index
PATCH /groups/new(.:format) groups#new
_form_groups PATCH /groups/_form(.:format) groups#_form
PATCH /groups/show(.:format) groups#show
GET /groups(.:format) groups#index
POST /groups(.:format) groups#create
GET /groups/new(.:format) groups#new
GET /groups/:id/edit(.:format) groups#edit
GET /groups/:id(.:format) groups#show
PATCH /groups/:id(.:format) groups#update
PUT /groups/:id(.:format) groups#update
DELETE /groups/:id(.:format) groups#destroy
GET /students/index2(.:format) students#index2
GET /students/index3(.:format) students#index3
GET /students/index4(.:format) students#index4
GET /students/index5(.:format) students#index5
GET /students/index6(.:format) students#index6
students_stats GET /students/stats(.:format) students#stats
login GET /login(.:format) sessions#new
POST /login(.:format) sessions#create
logout DELETE /logout(.:format) sessions#destroy
ppdatas3 GET /ppdatas/index3(.:format) ppdatas#index3
ppdatas2 GET /ppdatas/index2(.:format) ppdatas#index2
sessions_new GET /sessions/new(.:format) sessions#new
sessions_create GET /sessions/create(.:format) sessions#create
sessions_destroy GET /sessions/destroy(.:format) sessions#destroy
users GET /users(.:format) users#index
POST /users(.:format) users#create
new_user GET /users/new(.:format) users#new
edit_user GET /users/:id/edit(.:format) users#edit
user GET /users/:id(.:format) users#show
PATCH /users/:id(.:format) users#update
PUT /users/:id(.:format) users#update
DELETE /users/:id(.:format) users#destroy
GET /ppdatas(.:format) ppdatas#index
POST /ppdatas(.:format) ppdatas#create
GET /ppdatas/new(.:format) ppdatas#new
GET /ppdatas/:id/edit(.:format) ppdatas#edit
GET /ppdatas/:id(.:format) ppdatas#show
PATCH /ppdatas/:id(.:format) ppdatas#update
PUT /ppdatas/:id(.:format) ppdatas#update
DELETE /ppdatas/:id(.:format) ppdatas#destroy
GET /students(.:format) students#index
POST /students(.:format) students#create
GET /students/new(.:format) students#new
GET /students/:id/edit(.:format) students#edit
GET /students/:id(.:format) students#show
PATCH /students/:id(.:format) students#update
PUT /students/:id(.:format) students#update
DELETE /students/:id(.:format) students#destroy
course_years GET /courses/:course_id/years(.:format) years#index
POST /courses/:course_id/years(.:format) years#create
new_course_year GET /courses/:course_id/years/new(.:format) years#new
edit_course_year GET /courses/:course_id/years/:id/edit(.:format) years#edit
course_year GET /courses/:course_id/years/:id(.:format) years#show
PATCH /courses/:course_id/years/:id(.:format) years#update
PUT /courses/:course_id/years/:id(.:format) years#update
DELETE /courses/:course_id/years/:id(.:format) years#destroy
course_courses GET /courses/:course_id/courses(.:format) courses#index
POST /courses/:course_id/courses(.:format) courses#create
new_course_course GET /courses/:course_id/courses/new(.:format) courses#new
edit_course_course GET /courses/:course_id/courses/:id/edit(.:format) courses#edit
course_course GET /courses/:course_id/courses/:id(.:format) courses#show
PATCH /courses/:course_id/courses/:id(.:format) courses#update
PUT /courses/:course_id/courses/:id(.:format) courses#update
DELETE /courses/:course_id/courses/:id(.:format) courses#destroy
courses GET /courses(.:format) courses#index
POST /courses(.:format) courses#create
new_course GET /courses/new(.:format) courses#new
edit_course GET /courses/:id/edit(.:format) courses#edit
course GET /courses/:id(.:format) courses#show
PATCH /courses/:id(.:format) courses#update
PUT /courses/:id(.:format) courses#update
DELETE /courses/:id(.:format) courses#destroy
GET /predmets(.:format) predmets#index
POST /predmets(.:format) predmets#create
GET /predmets/new(.:format) predmets#new
GET /predmets/:id/edit(.:format) predmets#edit
GET /predmets/:id(.:format) predmets#show
PATCH /predmets/:id(.:format) predmets#update
PUT /predmets/:id(.:format) predmets#update
DELETE /predmets/:id(.:format) predmets#destroy
years GET /years(.:format) years#index
POST /years(.:format) years#create
new_year GET /years/new(.:format) years#new
edit_year GET /years/:id/edit(.:format) years#edit
year GET /years/:id(.:format) years#show
PATCH /years/:id(.:format) years#update
PUT /years/:id(.:format) years#update
DELETE /years/:id(.:format) years#destroy
Try
<li><%= link_to stats_prepodavatels_path %><li>
Does this work?