Journal.column_names returns the names of the columns in a table. How would I determine the type of a column? I tried: Journal.sql_types. ( didn''t work). hints, please. -- Best Regards, -Larry "Work, work, work...there is no satisfactory alternative." --- E.Taft Benson -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060606/7dd6fba3/attachment.html
Larry Kelly wrote:> Journal.column_names returns the names of the columns in a table. > > How would I determine the type of a column?Journal.columns returns a collection of Column objects, each with a name and a type (among other things). Type is a symbol Here''s the case statement class Column uses to cast SQL types to Ruby types, which is pretty good documentation of the types and how they get used: case type when :integer then Fixnum when :float then Float when :datetime then Time when :date then Date when :timestamp then Time when :time then Time when :text, :string then String when :binary then String when :boolean then Object end -- Josh Susser http://blog.hasmanythrough.com -- Posted via http://www.ruby-forum.com/.