Rails 4 - passing variable to partial

后端 未结 7 1456
没有蜡笔的小新
没有蜡笔的小新 2020-11-28 03:49

I am following the Ruby on Rails tutorial and have come across a problem while trying to pass variables to partials.

My _user partial is as follows

7条回答
  •  天命终不由人
    2020-11-28 04:05

    Don't use locals in Rails 4.2+

    In Rails 4.2 I had to remove the locals part and just use size: 30 instead. Otherwise, it wouldn't pass the local variable correctly.

    For example, use this:

    <%= render @users, size: 30 %>
    

提交回复
热议问题