I am developoing a Rails v2.3.2 app.
I have a controller:
class SchoolController < ApplicationController
...
def edit
@school=School.find_by_id params[:id]
end
def check_teachers
@teachers = @school.teachers
...
end
end
in app/views/schools/edit.html.erb I would like to have a link, click on it will trigger the check_teachers method in the controller, how to define the path for this link?
app/views/schools/edit.html.erb :
link_to 'Check teachers' WHAT_IS_THE_PATH_HERE
or
or you can define a named-route in
config/routes.rblike this:and call the url-helper generated by the named-route like this:
and you can use this id to find teachers in the controller