Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def self.count_habtm association
- output = {}
- self.count(:include => association.pluralize, :group => "#{association}_id").to_a.each do |a|
- #Ugly Ugly Ugly - I guess I'm missing something basic here
- label = eval(association.camelize).send("find",a[0].to_i).to_label if a[0]
- output[label] = a[1]
- end
- output
- end
- end
Add Comment
Please, Sign In to add comment