>
> I still want to figure out why count(*) does not return a number data
> type, but this will work for now.
>

The answer's quite straight forward - because Rails doesn't work that way.

The typecasting for a MySQL attribute to a Ruby class is done in the
read_attribute method in
the activerecord/lib/active_record/attribute_methods.rb file. In that method
you can see they only typecast the value if column_for_attribute returns the
column (i.e. if it's defined in the schema for the table).

So, your dynamically created column is not in the schema, so it won't be
typecast to an integer.

Cheers,


Andy

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to