Forum: Ruby on Rails syntax for number_with_precision

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
cranberry (Guest)
on 2006-03-02 13:13
I normally use number_with_precision in my views and I've never had a

Now however, I need to use it in my controller because my Ajax method is
calling the controller and the controller will return values to it which
will be displayed in the span of my html document.

In short, what am I doing wrong in the statement below? I need the 'bid'
to be formatted with precision before it is converted to a string.
Please note that returns a decimal number.

@bids.each do |bid_counter|
        mybid = number_with_precision(,2)
        bidhtml += "<tr><td>"+ bid_counter.user.company_name +
"</td><td>" +  bid_counter.ad_title + "</td><td>$" + mybid.to_s +

This topic is locked and can not be replied to.