Typecasting ActiveRecord Find Results

If you run a query such as the following:

Group.find(:select => ‘group.name, COUNT(members) as
member_count’, :joins => :members, :group => ‘group’)

All of the sql calculations (e.g. member_count) are typecast as
strings. Is there a way to specify how the results will be typcast?

p.s. I realize there are other ways to accomplish the example, but
this is a simplified version of the type of query I need to run taking
advantage of the :select option for the ActiveRecord Find method.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs