models/thing.rb
이라는 모델과 controllers/things_controller.rb
이라는 컨트롤러를 만들고 싶습니다. views/things/index.html.erb
및 views/things/hello.html.erb
이라는 뷰를 만들고 싶습니다.레일스가 새로운 MVC를 생성합니다
어떻게하면 레일 콘솔에서 할 수 있습니까? rails generate
을 사용해야한다는 것을 알고 있습니다.
models/thing.rb
이라는 모델과 controllers/things_controller.rb
이라는 컨트롤러를 만들고 싶습니다. views/things/index.html.erb
및 views/things/hello.html.erb
이라는 뷰를 만들고 싶습니다.레일스가 새로운 MVC를 생성합니다
어떻게하면 레일 콘솔에서 할 수 있습니까? rails generate
을 사용해야한다는 것을 알고 있습니다.
먼저 두 개의 동작 index
과 hello
을 사용하여 컨트롤러를 생성하십시오.
rails g controller things index hello
이 명령은 제어기 및 views/things/index.html.erb
views/things/hello.html.erb
과 함께 뷰를 생성한다. 당신이 더 많은 약 rails generate
명령을 알고 싶다면, 당신은 A Guide to The Rails Command Line
rails g model Thing attribute:type [...]
:
그런 다음 모델을 생성