Rails에서 routes.rb에 등록된 내용을 직관적으로 볼 수 있는 방법이 있어서 공유 합니다.

 

http://localhost:3000/rails/info/routes

동적 링크 helper 에서 사용할 경로가 “Helper” 열이며 실제로 해당 Helper를 호출했을 때 연결되는 action 4번째 열입니다.

. device_dhistory_index_path 호출하면 device/dhistory#index 호출되게 됩니다.

코드 상의 .

<li class="<%= 'current' if secondary_navigation?(:dhistory) %>">

                          <a href="<%= device_dhistory_index_path %>"> 여기서 호출

                            <span class="icon"><i class="icon5 i-arrow-right-3"></i></span>

                            <span class="txt"><%= I18n.t('menu.side.device.device_history') %></span>

                          </a>

                        </li>

 

이 때 호출 되는 페이지는 view / device / dhistory/index.html.erb가 됩니다.

by 무위자연 2016. 2. 17. 11:24
| 1 |