Add something like this to the helper for your scaffold's controller.

def precio_column(record)
  sprintf('%.2f', record.precio)
end

or use number_to_currency(), or number_with_precision() instead of
sprintf().

There also appears to be a more correct way of doing this using the
options[:format]
in the controller and i18n, which is outlined in here somewhere...
http://wiki.github.com/activescaffold/active_scaffold/api-column
But I cannot figure out exactly what the option content would be. Can
someone shed some light?

On Mon, Mar 15, 2010 at 8:08 PM, Head777 <[email protected]> wrote:

> Hey, thanks for the help i made it, and works great!!
>
> But i want some help more xD with another problem, see i have a field
> in my table call "price" and when i made the migration i made the
> field like this:
> t.decimal :precio, :precision => 8, :scale => 2, :default => 0
>
> And make me the table without a problem, but now when in my form i
> want to make a price like this:
> http://iv.pl/images/07250267848633729053.jpg
>
> and when stored in my table, show me the price in this way!
> http://iv.pl/images/90597016410276899628.jpg
>
> Really i dont know whats the matter, because when i made the excercise
> in the book "Agile Web Development" it make it in this way, and no
> give me any problem and in my table i see no problems too.
>
> Hope you can help me, again xD
>
> --
> You received this message because you are subscribed to the Google Groups
> "ActiveScaffold : Ruby on Rails plugin" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<activescaffold%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/activescaffold?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en.

Reply via email to