:entry_name does not change for will_paginate; not working?

◇◆丶佛笑我妖孽 提交于 2020-01-07 02:16:11

问题


Does anyone know why the entry name isn't changing to what I want?

<div class="digg_pagination">
  <div class="page_info">
    <%= page_entries_info @user_prices, :entry_name => 'Price', :plural_name => 'Prices' %>
  </div>
    <%= will_paginate @user_prices, :container => false %>
</div>

I already tried getting rid of the :plural_name option but that didn't work either. What could be the problem?


回答1:


At some point the :entry_name option in page_entries_info has changed to :model.

So you can now do (in 3.0.2 at least):

<%= page_entries_info @user_prices, :model => 'Price' %>



回答2:


Looks like its just a bug for will paginate so I just went into the translation file itself and did the following:

config/en.yml

en:
  activerecord:
    models:
      user_price:
        zero:  Prices
        one:   Price
        few:   Prices
        other: Prices


来源:https://stackoverflow.com/questions/8136835/entry-name-does-not-change-for-will-paginate-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!