I would suggest a nested route like so:
resources :subjects do
match '/screening', to: 'subjects#screening', as: :screening
end
Which should allow:
link_to "scr", subject_screening_path(sub)
#> /subjects/1/screening
I could be a little off with the naming. Be sure to check your routes (rake routes
in shell). Also, remove:
match '/subjects', to: 'subjects#show'
match '/newsubject', to: 'subjects#new'
match '/subjects', to: 'subjects#index'
match '/showsubject', to: 'subjects#show'
match '/editsubject', to: 'subjects#edit'
match '/screening', to: 'subjects#screening'
These routes are automatically generated with resources :subjects
, though by default their paths differ.