all = Type_service.exists?()
puts “table type_services exist ? \n #{all}”
type = Type_service.find(:all)
puts “table elements : #{type}\n\n\n”
p type
The “type” local variable above references an entire collection of
Type_service instances. The collection can be used like any Enumerable
object. Each individual entry (each Type_service instance) corresponds
to a
record from your table. It will have an attribute accessor for each
column
in your table.
FYI: the convention when using ActiveRecord is to define your model
class
w/out the underscore and with each word capitalized:
class TypeService < ActiveRecord::Base
end
The above class would correspond to a table named “type_services”.
Also, you should consider posting ActiveRecord questions in the ruby on
rails mailing list since AR is part of rails: