I am trying to use the money-rails gem in my 4 rails app.
I have a participant model in which there are attributes for each of the currencies and participation. My goal is for users to specify the currency for each instance and the amount of the cost of participation.
In my member model, I:
monetize: participation_cost, with_model_currency :: amount_currency
In my form, I ask users to select a currency and indicate the amount as follows:
<%= f.input :participation_cost, label: 'What amount will you pay for participation costs?', :label_html => { :class => 'question-participants' }, placeholder: 'Whole numbers only', :input_html => {:style=> 'width: 250px; margin-top: 20px', class: 'response-participants'} %> <br><br> <%= f.input :currency, label: 'Select your costs currency', label_html: {class: 'fundingspace'}, collection: ["AUD Australian Dollars", "GBP British Pounds", "USD US Dollars" ], prompt: "Choose one" %> </div> <br>
In my opinion, I want to display the currency and amount. I currently have a line:
<%= "#{@project.scope.try(:participant).try(:participation_cost)} #{@project.scope.try(:participant).try(:currency)}" %>
When I check this, I get only a number that is a member of the participation. I do not receive currency.
In my money.rb initializer, I have:
config.default_currency = :gbp
Can anyone help? I do not know how to use this stone. I followed the user manual, but it gets to how to configure the model to select the currency based on the instance. Has anyone successfully used it for this purpose?
thanks