title: How to resolve this error erb is throwing when passing a currency formatted string
body: <p>I'm using a module within my Rails App to perform some actions and render a html file and save it to S3. So far so good, apart from the fact that I need to pass a currency variable to to be rendered and erb is throwing this error: </p>
  
  <pre><code>undefined method `/' for "3,395,000":String
  </code></pre>
  
  <p>Here's my code:</p>
  
  <pre><code>options = {
    ...
    price: Money.new(@case.cash_price / 100.to_i, "DKK").format.to_s.html_safe,
    ...
  }
  </code></pre>
  
  <p>And here's my module:</p>
  
  <pre><code>def generate_html(options)
    require 'erb'
  
    erb_file = "templates/banners/widesky.html.erb"
  
    erb_str = File.read(erb_file)
  
    ...
    @price = options[:price]
    ...
  
    renderer = ERB.new(erb_str)
    result = renderer.result(binding)
  
    FileUtils.mkdir_p('temp') unless File.directory?('temp')
  
    File.open('temp/index.html', 'w') do |f|
      f.write(result)
    end
  
    'temp/index.html'
  
  end
  </code></pre>
  
  <p>And I tried formatting the currency in different ways, but I always get the same error. Any ideas why?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p><code>@case.cash_price</code> originally is an Integer. I want to convert it to a string with commas (hence using Money to format it). The problem seems to be that <code>erb</code> doesn't like the formatted result and throw the above error.</p>