2010-12-30 3 views
2

저는 최상의 방법으로 모델에서 뷰를 렌더링하는 방법을 찾으려고합니다. 지금까지 발견 한 가장 좋은 방법은 AbstactController를 확장하는 것입니다. 왜냐하면 MVC로 코드를 구성 할 수 있기 때문입니다. 이제 약간의 문제 만 남았습니다. 뷰를 렌더링하기 위해 액션 메소드에서 명시 적으로 렌더링을 호출해야합니다 (레일에서는 필요하지 않음).AbstractController의 하위 클래스는 명시 적 렌더링 호출이 필요합니다.

예 : ActionMailer 대신 AbstractController를 확장 한 EmailsController 클래스를 구현했습니다.

class EmailsController < AbstractController::Base 
    include AbstractController::Rendering 
    include AbstractController::Layouts 
    include AbstractController::Helpers 
    include AbstractController::Translation 
    include AbstractController::AssetPaths 
    include ActionController::UrlWriter 

    helper ApplicationHelper 

    self.view_paths = "app/views" 

    def notification 
    render 'notification' 
    end 
end 

어떻게 렌더 호출을 제거 할 수 있습니까?

감사합니다.

답변

관련 문제