The active field in the memberships table is an int.
So why this works :
def active_projects
projects.select{|p| p.active=='1'}.sort_by {|p| [p.name.upcase]}
end
while this does not :
def active_projects
projects.select{|p| p.active==1}.sort_by {|p| [p.name.upcase]}
end
The difference is just that I compare with an integer instead of a
string in the first case. I was expecting p.active to be a integer,
not
a string.
When you pick attributes not from the base table (in this case
projects) rails will handle things as strings. Maybe not what one
would hope for, but it's the way things are right now.