Grouping by Name but disregarding capitalization
I have b开发者_StackOverflow中文版uilt a Ruby on Rails app that allows users to track workouts. I also allow them to add groups (like blog tags) to workouts to help keep organized. In most places where I display the tags I do so by grouping by name.
@group_counts = current_user.groups.count(:group => :name,
:order => 'count_all DESC')
Is there a way to disregard capitalization. For instance I have two different records returned for Push press
and Push Press
.
You may want to consider putting a callback in your Group model to downcase or upcase the user input to make everything consistent. That way you don't have to deal with the capitalization issue in the query.
精彩评论