calling a controller method from view Ruby on rails

后端 未结 4 1441
囚心锁ツ
囚心锁ツ 2021-01-02 22:22

I am very new to ruby. I have one doubt, how to call a controller method from a view.

my controller

def course_user_count
 @courses         


        
4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-02 23:13

    declare method name as the helper method

    In the view call the method as

    <% count = course_user_count %>
    

提交回复
热议问题