On Sat, Apr 3, 2010 at 4:02 PM, RichardOnRails <
[email protected]> wrote:

> Hi,
>
> It appears to me that the command:
> ruby script/generate scaffold whatever money_field:decimal(10,2)
> will not generate a valid migration.
>
>
Yes, the syntax is invalid and the correct syntax should be:

ruby script/generate scaffold whatever money_field:decimal

Next, you'll simply have to edit the migration file to add the scale option.

Good luck,

-Conrad


> Therefore it appears to me only two ways to achieve the desired result
> is:
>
> 1.1  Omit the the precision/scale on the scaffold command
> 1.2  Edit the migration file by following the "do |t| ... end" with
> the command:
>
> change_column :whatever :money_field,    :amount,    :decimal,  :precision
> => 10, :scale => 2
> I think this approach worked for me
>
> 2.1  Omit the money_field in it's entirety
> 2.2  Create a second migration file an add the command:
>
> add_column :whatever :money_field,    :amount,    :decimal,  :precision
> => 10, :scale => 2
> I'm guessing this will work as well
>
> BTW, I'm running Rails 2.3.5, Ruby 1.8.6, WinXP-Pro/SP3, Firefox
> 3.6.2, Firebug 1.5.3,
> MySQL 5.0.37-community-nt, Mongrel, Apache HTTP Server 2.2.15
>
> What do you think?
>
> Best wishes,
> Richard
>
> --
> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to