Thursday, December 28, 2006

Mysql Decimal Precisin Scale - Doesn't work

In Rails Migration scripts if a table column is defined as
t.column :my_decimal_column, :decimal, :precision =>8, :scale =>2, :default =>0.00, it would result with a column decimal(10,0) in Mysql db. The problem is with the current stable rails. With Edgerails, it will work.

Visit EdgeRails at http://wiki.rubyonrails.com/rails/pages/EdgeRails

A work aroung for this could be, in your migration script use:

execute "alter table my_table modify column my_decimal_column decimal(8,2)" instead.

Monday, December 25, 2006

Parallels Windows TOAD + Ubuntu - MySql


1. Install SSH server for remote access
sudo apt-get install ssh

2. Install MySql database server
sudo apt-get install mysql-server

3. Install Apache HTTP Server
(as super user, otherwise you might get into problem with domain name as at after installation it says:
Could not determine the server's fully qualified domain name, using 127.0.1.1)
sudo apt-get install apache2

3.1 Test apache installation by pointing browser at http://localhost or http://yourcomputername

4. Install PHP for Apache HTTP server
sudo apt-get install php4

5. MySql for Apache HTTP server
sudo apt-get install libapache2-mod-auth-mysql
sudo apt-get install php4-mysql

Very useful Migration Helper

http://seb.box.re/articles/2006/07/29/foreign-key-and-rails-migration

Sunday, December 24, 2006

Setting up RoR dev environment in Ubuntu 6.10


1. Download and install eclipse
sudo apt-get install eclipse
2. Start Eclipse
Applications->Programming->Eclipse
3. If it fails complaining jre not found at /usr/lib/j2sdk1.4-sun/bin, copy from /usr/bin
cd /usr/lib
mkdir j2sdk1.4-sun
cd j2sdk1.4-sun
mkdir bin
cd bin
cp /usr/bin/java .
4. Start Eclipse
Applications->Programming->Eclipse
5. Install Subclipse plugin
Help->Software Updates->Find and Install
Select Search for new features to install
Click New Remote Site and enter
Name: Subclipse URL: http://subclipse.tigris.org/update_1.0.x
...
Finish Installation and restart Eclipse
6. Install Ruby Development Tools (RDT) plugin
Help->Software Updates->Find and Install
Select Search for new features to install
Click New Remote Site and enter
Name: RDT URL: http://updatesite.rubypeople.org/release
...
Finish Installation and restart Eclipse
7. Install Radrails plugin for Ruby on Rails development
Help->Software Updates->Find and Install
Select Search for new features to install
Click New Remote Site and enter
Name: RadRails URL: http://radrails.sourceforge.net/update
...
Finish Installation and restart Eclipse
8. Setup svn repository
Windows->Open perspective->Other and select SVN Repository Exploring
In the SVN Repository view right click and select New->Repository Location
Enter your repository location like: http://myproject.svnrepository.com/myproject/trunk
Enter user id and password

Friday, December 15, 2006

DrySql

Found this interesting which further simplifies ActiveRecord and makes model code more DRY.

DrySql