I have a brief question... pretty new to rails, and I was wondering if you could help me with an issue that I'm having in code. I have a set of input boxes (it's an online app that asks for revenues and expenses) where I would like to format the currency. I've been using the following line of code for other independent input boxes (text_fields) within the app, but for some reason, it wont work when i try to add it to the income statement fields
code I have been using:
= f.text_field :user_nummber, :value=>number_to_currency(f.object.user_number)
the area of code i've been having issues with:
= f.fields_for :income_statements do |ff|
.section_total.income_statement{ :id => "income_statement_#{ff.object.year}" }
= ff.hidden_field :id
= ff.hidden_field :year
%h3.financials_year= ff.object.year
.financials_data
.section
%h2.green_text Revenue
%div{:class => "label_rightalign_investor field"}
= ff.label :net_sales
= ff.text_field :net_sales, :value=>number_to_currency(ff.object.net_sales), :class => 'add'
%div{:class => "label_rightalign_investor field"}
= ff.label :interest_income
= ff.text_field :interest_income, :value=>number_to_currency(ff.object.interest_income), :class => 'add'
%div{:class => "label_rightalign_investor field", :style => 'font-weight: bold' }
= label_tag 'Total'
= text_field_tag 'total_revenue', '', :class => 'calculate add_total', :readonly => true
Please note that the final total_revenue field calculates the values with class:add (net sales & interest income)
Any help in what i'm doing wrong, and why my text_fields (input box) does not display values in the following format: $x,xxx.00 would be appreciated.
I sincerely thank you for your help and time!