我在我的 Rails 4 应用程序中使用 money-rails。
我显示我的货币化属性没有美分。我希望用户只输入整美元/英镑的金额(所以不是 100 是 1 美元,我希望它是 100 美元)。
在我的表格中,我问用户:
<%= par.input :participation_cost_pennies, label: false, placeholder: 'Whole numbers only', :input_html => {:style => 'width: 250px; margin-top: 20px', class: 'response-project'} %>
在我的节目中,我有:
<%= money_without_cents_and_with_symbol @project.scope.participant.participation_cost %>
我想知道如何将 .00 添加到用户在表单中输入的任何内容中,或者最好将输入的值设为美元金额而不是美分金额。有谁知道这是怎么做到的吗?
我已经删除了我的 money.rb 初始化程序中的美分:
config.default_format = {
:no_cents_if_whole => nil,