본문 바로가기

Ruby on Rails

[Ruby on Rails] 로또 번호 추첨 2

반응형

1. app > views 는 lotto_controller.rb 와 연결된 view 이다.

2.  lotto 폴더안에 오른쪽마우스 새로만들기에서 파일을 만들어준다.

3. index.html.erb 에 h1 태그를 작성한다.

4. lotto_controller.rb 에

def html 이름end작성

 

5. router 설정하기

 

6. Rails 가이드에 Route 를 참조한다.

guides.rubyonrails.org/routing.html

 

Rails Routing from the Outside In — Ruby on Rails Guides

Rails Routing from the Outside InThis guide covers the user-facing features of Rails routing.After reading this guide, you will know: How to interpret the code in config/routes.rb. How to construct your own routes, using either the preferred resourceful st

guides.rubyonrails.org

복사한다

get '/patients/:id', to: 'patients#show'

 

7. get '/patients/:id', to: 'patients#show' 여기에서 앞 따옴표는 아무거나 기입하고

두번째 따옴표는 controller#view 적어주고 실행한다.

 

 

8. 복사하여 사이트 오픈한다.

lotte-site-vdbkd.run.goorm.io/

9. lotte-site-vdbkd.run.goorm.io/ 주소 뒤에 gogo 작성한다

lotte-site-vdbkd.run.goorm.io/gogo

 

표시 된다.

반응형

'Ruby on Rails' 카테고리의 다른 글

[Ruby on Rails] 로또 번호 추첨 4  (0) 2021.03.12
[Ruby on Rails] 로또 번호 추첨 3  (0) 2021.03.12
[Ruby on Rails] 로또 번호 추첨 1  (0) 2021.03.11