2013-04-14 1 views
2

models/thing.rb이라는 모델과 controllers/things_controller.rb이라는 컨트롤러를 만들고 싶습니다. views/things/index.html.erbviews/things/hello.html.erb이라는 뷰를 만들고 싶습니다.레일스가 새로운 MVC를 생성합니다

어떻게하면 레일 콘솔에서 할 수 있습니까? rails generate을 사용해야한다는 것을 알고 있습니다.

답변

4

먼저 두 개의 동작 indexhello을 사용하여 컨트롤러를 생성하십시오.

rails g controller things index hello

이 명령은 제어기 및 views/things/index.html.erbviews/things/hello.html.erb과 함께 뷰를 생성한다. 당신이 더 많은 약 rails generate 명령을 알고 싶다면, 당신은 A Guide to The Rails Command Line

좀 걸릴 수 있습니다

rails g model Thing attribute:type [...]

:

그런 다음 모델을 생성

관련 문제