2011-12-09 2 views
0

나는 CSS와 JS 코드와 함께 만든 html 홈페이지가있다. 루비 응용 프로그램에 홈페이지로 포함시키고 싶습니다. 내 설정/routes.rb에서 나는이 있습니다 ruby가 홈 페이지를 html 파일로 바꾼다

# You can have the root of your site routed with "root" 
    # just remember to delete public/index.html. 
    # root :to => 'welcome#index' 
    root :to => 'first_controller#index', :as => 'first_controller' 

와의

first_controller 나는이있다 :

class FirstControllerController < ApplicationController 

    def index 
     @users = User.all 
    end 

end 

가 내 html 파일로 리디렉션 def home 방법을 만들 수 있습니까?

@users = User.all은 책의 메신저에서 가져온 코드입니다.이 코드는 루비 앱을 만드는 방법을 가르쳐 주며, 내 필요에 맞게 수정합니다. 들으

답변

0

당신은 일반 HTML이기 때문에, 당신은 레일을 캐시 할 수있다, 또한

class FirstControllerController < ApplicationController 

    def index 
    @users = User.all 
    end 

    def home 
    render :template => "relative/path/from/views", :layout => false 
    end 

end 

할 수 있습니다. 컨트롤러에 caches_page :home을 추가하십시오.

편집 : 서식

관련 문제