我使用best_in_place寶石編輯餘額:best_in_place寶石編輯貨幣
index.html.erb:
<%= best_in_place bankaccount, :balance, :display_with => :number_to_currency %>
但編輯後,我得到一個未格式化的數量($改變45〜46顯示爲46)。
我該如何獲得best_in_place作爲$$$顯示新值?
控制器:
respond_to :html, :json
...
def update
@bankaccount = Bankaccount.find(params[:id])
if @bankaccount.update_attributes(params[:bankaccount])
respond_with @bankaccount
else
render :json => @bankaccount.errors.full_messages, :status => :unprocessable_entity
end
# if @bankaccount.update_attributes(params[:bankaccount])
# redirect_to @bankaccount, :notice => "Successfully updated bankaccount."
# else
# render :action => 'edit'
# end
end
你試過':helper_options => {:unit =>「$」}'? – ScottJShea 2012-03-06 01:02:33