[Nitro] Again me...
Emmanuel Piperakis
epiperak at softlab.ece.ntua.gr
Mon Sep 5 23:18:47 EDT 2005
Sorry for all the bothering...
I would like to store in the DB an object of type Currency that I made.
(Just a Float will not do, I need to convert from JPY, to USD, EUR, and so
on, but also store the different type of number each time - once
representing JPY with no decimal digits, the other time USD with 2
decimal, etc etc). So I did the followin in the model.rb
class Currency < Float
def initialize(value = 0.0, type = 'JPY', precission = 0)
super
@value, @type, @precission = value, type, precission
end
def jpy
end
def usd
end
def eur
end
end
and then
class Project
property :locality, String # domestic, foreign
property :state, String # fixed, planned, under development
property :fee_per, Float
property :fee, Currency
belongs_to :officer
belongs_to :group
belongs_to :company
has_many :loans
has_many :investments
has_many :reports
has_one Bgroup
end
But Og complains in property :fee, Currency
with...
/usr/lib/ruby/1.8/mysql.rb:453:in `read': You have an error in your SQL
syntax. Check the manual that corresponds to your MySQL server version
for th
e right syntax to use near ' investment_size integer, type text,
acquisition_date date, pla (Mysql::Error)
from /usr/lib/ruby/1.8/mysql.rb:345:in `read_query_result'
from /usr/lib/ruby/1.8/mysql.rb:160:in `real_query'
from /usr/lib/ruby/1.8/mysql.rb:275:in `query'
from
/usr/lib/ruby/gems/1.8/gems/og-0.23.0/lib/og/store/mysql.rb:229:in
`create_table'
from (eval):5:in `send'
from (eval):5:in `og_create_schema'
from
/usr/lib/ruby/gems/1.8/gems/og-0.23.0/lib/og/store/sql.rb:290:in `enchant'
from
/usr/lib/ruby/gems/1.8/gems/og-0.23.0/lib/og/store/mysql.rb:152:in
`enchant'
from
/usr/lib/ruby/gems/1.8/gems/og-0.23.0/lib/og/manager.rb:130:in `manage'
from
/usr/lib/ruby/gems/1.8/gems/og-0.23.0/lib/og/manager.rb:186:in
`manage_classes'
from
/usr/lib/ruby/gems/1.8/gems/og-0.23.0/lib/og/manager.rb:186:in `each'
from
/usr/lib/ruby/gems/1.8/gems/og-0.23.0/lib/og/manager.rb:186:in
`manage_classes'
from /usr/lib/ruby/gems/1.8/gems/og-0.23.0/lib/og.rb:119:in
`setup'
Any ideas?
Emmanouil Piperakis (epiperak at cs.ntua.gr)
{To explore is Human, to Create is Devine,
To teach is Primal, to Rule is Sin}
More information about the Nitro-general
mailing list