Im trying to use Money-Rails with my Rails 4 app.
I have a participants model which has attributes as follows:
t.boolean "costs"
t.integer "participation_cost_pennies", default: 0, null: false
t.string "participation_cost_currency", default: "GBP", null: false
Users can select their currency and that should override the default GBP setting.
Im my view, I have:
<% if @project.scope.try(:participant).try(:costs) == true %>
<%= @project.scope.try(:participant).try(humanized_money_with_symbol :@participation_cost_pennies) %>
When I try the above, the view shows up blank (no display of anything). When I try to inspect the element in the google browser, I can only see an empty span tag in which that code is set out (with nothing).
I previously tried the following, bit it displayed the price in pennies (as in $6 as 600 USD:
<%= "#{@project.scope.try(:participant).try(:participation_cost_pennies)} #{@project.scope.try(:participant).try(:participation_cost_currency)}" %>
Can anyone see what I've done wrong? I'd like to display $4 instead of 400 cents/pennies.
Thank you