Forum: Ruby on Rails legacy database on remote host

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Charlie B. (Guest)
on 2006-01-18 16:31
I'm getting this error in webrick then it crashes leaving nothing in the
log.

ruby: symbol lookup error:
/usr/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.so: undefined symbol:
mysql_sqlstate

Here is the standard query I would normally write to get the data.

select * from child,parent
where CONCAT(SUBSTRING(child.item_number,1,14,'00') =
parent.order_number and parent.order_number = '4444444444444400'


Here are my models and my database.yml

class Parent < ActiveRecord::Base
        set_table_name  :parent
        set_primary_key :order_number
        has_many        :child,
                                                :class_name     =>
'AppName',
                                                :finder_sql     =>
"select child.* from child,parent " +
                                                                                                                "
where CONCAT(SUBSTRING(child.item_number,1,14,'00') =
parent.order_number"
end
class Child < ActiveRecord::Base
        set_table_name  :child
        set_primary_key :item_number
        belongs_to      :parent,
                                                        :foreign_key =>
'order_number',
                                                        :class_name
=> BeeOrder
end

development:
  adapter: mysql
  database: legacy_test
  username: john
  password: doe
#  socket: /var/lib/mysql/mysql.sock
  host: my_host
  port: 3306

I"ve been pulling my hair out for a week trying to get this legacy
database working! Please help!
Charlie B. (Guest)
on 2006-01-18 16:35
This is the correct model name, in my hast to change the names before I
posted I forgot to change this one. Can anyone help?


Here are my models and my database.yml

 class Parent < ActiveRecord::Base
         set_table_name  :parent
         set_primary_key :order_number
         has_many        :child,
                                                 :class_name     =>
 'Child',
                                                 :finder_sql     =>
"select child.* from child,parent " +
                                                                                                               "
where CONCAT(SUBSTRING(child.item_number,1,14,'00') =




> Here are my models and my database.yml
>
> class Parent < ActiveRecord::Base
>         set_table_name  :parent
>         set_primary_key :order_number
>         has_many        :child,
>                                                 :class_name     =>
> 'AppName',
>                                                 :finder_sql     =>
> "select child.* from child,parent " +
> 
"
> where CONCAT(SUBSTRING(child.item_number,1,14,'00') =
Rob B. (Guest)
on 2006-01-18 17:14
(Received via mailing list)
...,1,14 ) , '00') = ...
missing ')' perhaps?
Charlie B. (Guest)
on 2006-01-18 17:21
Thank you, but I fixed that but I still get the same error.

Rob B. wrote:
> ...,1,14 ) , '00') = ...
> missing ')' perhaps?
This topic is locked and can not be replied to.