Solved it like that:

abilities_array = []
    roles.map(&:abilities).flatten(1).each do |e|
      if i = abilities_array.find_index{|ar| ar[1]==e[1] && ar[2]==e[2]}
        abilities_array[i] = e
      else
        abilities_array << e
      end
    end
    abilities_array.map{|a| "#{a[0]} #{a[1]}, #{a[2]}#{", "+a[3] unless
a[3].blank?}"}

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/c390cc0841af9587a804c13f66700726%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to