Hi, Can anyone explain how to use decimals in Rails scaffolding ? When I enter the scaffold command : ruby script/generate scaffold payment amount:decimal, :precision => 10, :scale => 2 event:string datum:date nothing happens. No error message, no generating of files, nothing. When I enter the scaffold command : ruby script/generate scaffold payment amount:decimal event:string datum:date and then open the generated migrate file and add precision and scale : t.decimal :amount, :precision => 10, :scale => 2 then an amount column of type decimal(10,2) is created in my MySQL db. Is it not possible to describe the precision and scale in the scaffold command ? Thanks -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I had tried to my best. Since there were no option to specify the additional parameters. It has to be manually specified in the migration file. Revert back me if u find any solution to it. On Feb 20, 4:57 pm, nfv <nico.vanop...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > Can anyone explain how to use decimals in Rails scaffolding ? > > When I enter the scaffold command : > > ruby script/generate scaffold payment amount:decimal, :precision => > 10, :scale => 2 event:string datum:date > > nothing happens. No error message, no generating of files, nothing. > > When I enter the scaffold command : > > ruby script/generate scaffold payment amount:decimal event:string > datum:date > > and then open the generated migrate file and add precision and > scale : > > t.decimal :amount, :precision => 10, :scale => 2 > > then an amount column of type decimal(10,2) is created in my MySQL db. > > Is it not possible to describe the precision and scale in the scaffold > command ? > > Thanks-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Loganathan Ganesan
2010-Feb-20 13:12 UTC
Re: How to describe a decimal field in Rails scaffolding
nfv wrote:> Hi, > > Can anyone explain how to use decimals in Rails scaffolding ? > > When I enter the scaffold command : > > ruby script/generate scaffold payment amount:decimal, :precision => > 10, :scale => 2 event:string datum:date > > nothing happens. No error message, no generating of files, nothing. > > When I enter the scaffold command : > > ruby script/generate scaffold payment amount:decimal event:string > datum:date > > and then open the generated migrate file and add precision and > scale : > > t.decimal :amount, :precision => 10, :scale => 2 > > then an amount column of type decimal(10,2) is created in my MySQL db. > > Is it not possible to describe the precision and scale in the scaffold > command ? > > ThanksI tried to my best. Since there are no option to specify it, the only way to do it by manually editing in the migration file. Revert back me if u find any more solution. Thanks -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.