A
aix aix
Hello,
So now, before I use the DBI module to communicate with my MySQL
database.
Now, I turn to ActiveRecord.
I'll be home I connect, do queries, etc. However, recovery / reading
information is unclear.
Here is my code:
require 'rubygems'
require 'active_record'
ActiveRecord::Base.establish_connection(
:adapter => 'mysql',
:host => 'localhost',
:username => 'root',
assword => 'toor',
:database => 'demo'
)
class Type_service < ActiveRecord::Base
end
all = Type_service.exists?()
puts "table type_services exist ? \n #{all}"
type = Type_service.findall)
puts "table elements : #{type}\n\n\n"
p type
And the result :
table type_services exist ?
true
table elements:
#<Type_service:0x7f0c5bb535d8>#<Type_service:0x7f0c5bb53560>
[#<Type_service id_type_s: 1, label_type_s: "D\303\251di\303\251">,
#<Type_service id_type_s: 2, label_type_s: "Mutualis\303\251">]
How to get the results clearly?
Thanks
So now, before I use the DBI module to communicate with my MySQL
database.
Now, I turn to ActiveRecord.
I'll be home I connect, do queries, etc. However, recovery / reading
information is unclear.
Here is my code:
require 'rubygems'
require 'active_record'
ActiveRecord::Base.establish_connection(
:adapter => 'mysql',
:host => 'localhost',
:username => 'root',
assword => 'toor',
:database => 'demo'
)
class Type_service < ActiveRecord::Base
end
all = Type_service.exists?()
puts "table type_services exist ? \n #{all}"
type = Type_service.findall)
puts "table elements : #{type}\n\n\n"
p type
And the result :
table type_services exist ?
true
table elements:
#<Type_service:0x7f0c5bb535d8>#<Type_service:0x7f0c5bb53560>
[#<Type_service id_type_s: 1, label_type_s: "D\303\251di\303\251">,
#<Type_service id_type_s: 2, label_type_s: "Mutualis\303\251">]
How to get the results clearly?
Thanks