DB를 사용하지 않고 인덱스 및 약 페이지로 간단한 응용 프로그램을 코딩하고 싶습니다. 모든 텍스트가 뷰에 있습니다. 하지만 내 컨트롤러 메서드를 호출하여 뷰를 변경할 수는 없습니다. 여기 은 (home_controller.rb) 컨트롤러간단한 Ruby on Rails 앱
class HomeController < ApplicationController
def index
end
def about
end
end
레이아웃 :
!!!
%html
%head
%title Title
= stylesheet_link_tag "application"
= javascript_include_tag "application"
= csrf_meta_tags
%body
.wrapper
= yield
.footer
홈 인덱스보기 :보기에 대한
%h2 Index
%h1
This is example page
%p
= link_to "Home", root_path
= link_to "About", :controller => "home", :action => "index"
%p
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
:
routes.rb에서%h2 About
%h1
This is about page
%p
= link_to "Home", root_path
= link_to "About", :controller => "home", :action => "about"
%p
Lorem ipsum
나는있다. 내가 내 도메인을 호출 할 때 내가 쓸 때
, 내가 인덱스를 얻을 수 있습니다 : 도메인/가정/색인은 내가 얻을
[GET]어떤 경로 일치하는 항목이 없습니다 "/ 홈/색인"
전화 할 때도 마찬가지입니다. 어떻게 내 페이지에 전화 할 수 있습니까? 레이크 노선 줘 :
루트/{: 컨트롤러 => "홈", : 행동 => "인덱스"}
템플릿 {에 대한 템플릿 홈/약, 응용 프로그램/누락 누락 된 선 위에 파일 빌더 : coffee, : haml], : formats => [: html], : : locale => [: en, : en]}을 입력하십시오. 검색된 위치 : * "/ mnt/_Projects/exapmle2/app/views"wtf? 나는 이것을 가지고있다 – byCoder
당신은'/ app/views/home/about.html.haml'을 가지고 있습니까? –
ofc 나는 가지고있다, 이것은 흥미 롭다 – byCoder