0

나는 방금 padrino/sinatra에서 레일로 전환하여 라우팅 물건이 나를 괴롭혔습니다.레일즈 3 컨트롤러 내에서 라우팅

내가 정의한

, 내 routes.rb 파일에

namespace :admin do 
    resources :teachers, :students, :lessons 
    end 

, 그리고 난 레이크 경로를 실행할 때 그것은 나를주는 명령,

문제가
admin_teachers GET /admin/teachers(.:format)   admin/teachers#index 
        POST /admin/teachers(.:format)   admin/teachers#create 
new_admin_teacher GET /admin/teachers/new(.:format)  admin/teachers#new 
edit_admin_teacher GET /admin/teachers/:id/edit(.:format) admin/teachers#edit 
    admin_teacher GET /admin/teachers/:id(.:format)  admin/teachers#show 
        PUT /admin/teachers/:id(.:format)  admin/teachers#update 
        DELETE /admin/teachers/:id(.:format)  admin/teachers#destroy 
    admin_students GET /admin/students(.:format)   admin/students#index 
        POST /admin/students(.:format)   admin/students#create 
new_admin_student GET /admin/students/new(.:format)  admin/students#new 
edit_admin_student GET /admin/students/:id/edit(.:format) admin/students#edit 
    admin_student GET /admin/students/:id(.:format)  admin/students#show 
        PUT /admin/students/:id(.:format)  admin/students#update 
        DELETE /admin/students/:id(.:format)  admin/students#destroy 
    admin_lessons GET /admin/lessons(.:format)   admin/lessons#index 
        POST /admin/lessons(.:format)   admin/lessons#create 
    new_admin_lesson GET /admin/lessons/new(.:format)  admin/lessons#new 
edit_admin_lesson GET /admin/lessons/:id/edit(.:format) admin/lessons#edit 
     admin_lesson GET /admin/lessons/:id(.:format)  admin/lessons#show 
        PUT /admin/lessons/:id(.:format)  admin/lessons#update 
        DELETE /admin/lessons/:id(.:format)  admin/lessons#destroy 

, 내가 알아낼 수 없습니다 관리자/학생에게 요청에 응답하는 방법 # 업데이트? 내가 관리자 # 교사에게 응답하는 방법을 알고, 내 관리자 컨트롤러에서 나는 교사 기능을 만듭니다. 그러나 관리자/교사/색인에 어떻게 반응합니까? 아니면 어디에서 응답해야합니까? 어떤 파일에 있습니까? 어떤 함수 나 클래스에서? 에 기록됩니다

rails generate controller admin/students update 

: 당신은이 파일을 생성 할 수 있습니다

class Admin::StudentsController < ApplicationController 
    def update 
    # update here 
    end 
end 

: admin/students#update 레일 여기 조치를 찾습니다 들어

답변

1

app/controllers/admin/students_controller.rb 
+0

을 발전기가있다 이거? 이 파일을 새 파일에 어디에 넣어야합니까? – gkaykck