Hello,
I am trying to wrap sequel around a legacy database whose columns have
names like [Index dossier] and [référence du mandant].
Don't suggest me to rename these columns: I wish I could but,
unfortunately, it is not an option.
the base is stored in a microsoft SQL server and the client system is
Windows 7. I connect with the ODBC adapter (odbc:///dsn_name?db_type=mssql)
I tried to define models with the code below:
class Dossier < Sequel::Model :Dossiers
set_primary_key ["Index dossier".to_sym]
many_to_one :cas, :key=>"Index du cas".to_sym
end
class Cas < Sequel::Model
set_primary_key ["Index du cas".to_sym]
many_to_one :address, :key=>:IndexduMandant
one_to_many :dossiers
end
class Address < Sequel::Model :ADRESSES
set_primary_key ["Index adresse".to_sym]
one_to_many :cases
end
When it comes to descending the tree, itfails:
irb(main):005:0> Address.first.cases
NoMethodError: undefined method `Index adresse' for #<Address:0x1ac7f00>
from
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sequel-4.4.0/lib/sequel/model/associations.rb:473:in
`block in can_have_associated_objects?'
from
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sequel-4.4.0/lib/sequel/model/associations.rb:473:in
`each'
from
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sequel-4.4.0/lib/sequel/model/associations.rb:473:in
`any?'
from
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sequel-4.4.0/lib/sequel/model/associations.rb:473:in
`can_have_associated_objects?'
from
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sequel-4.4.0/lib/sequel/model/associations.rb:1561:in
`_load_associated_objects'
from
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sequel-4.4.0/lib/sequel/model/associations.rb:1654:in
`load_associated_objects'
from
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sequel-4.4.0/lib/sequel/model/associations.rb:1166:in
`block in def_association_method'
from (irb):5
from
C:/Ruby200/lib/ruby/gems/2.0.0/gems/sequel-4.4.0/bin/sequel:234:in `<top
(required)>'
from C:/Ruby200/bin/sequel:23:in `load'
from C:/Ruby200/bin/sequel:23:in `<main>'
Any help?
thank you
Giovanni
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/groups/opt_out.