Re: [Rails] Re: find duplicates in each array rails

2010-11-30 Thread Michael Pavling
On 30 November 2010 14:10, PalaniKannan K wrote: > I need the results have to print without duplicates. This gives the results > with duplicates. > and > presents same results with duplicates. Please about your suggestion. I'm having trouble seeing where you're even trying to explain what you h

Re: [Rails] Re: find duplicates in each array rails

2010-11-30 Thread PalaniKannan K
Dear Michael, Thanks lot for your answer. <% @sp_references.each do |sp_ref| %> > <%= sp_ref.all_references.map(&:reference).uniq.delete_if{|ref| ref > =~ /emend$/i}.join("") %> > <% end %> > I need the results have to print without duplicates. This gives the results with duplicates. * <% @sp

Re: [Rails] Re: find duplicates in each array rails

2010-11-29 Thread Michael Pavling
On 29 November 2010 16:23, PalaniKannan K wrote: > Yes I accept, any other way to extract the distinct content from each array? Which array? The "sp_ref.all_references" array that you're iterating, or a different one? Are you're asking "how would I get a collection of distinct "reference" values

Re: [Rails] Re: find duplicates in each array rails

2010-11-29 Thread PalaniKannan K
Dear Fred, Yes I accept, any other way to extract the distinct content from each array? -- With Regards, Palani Kannan. K -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups

[Rails] Re: find duplicates in each array rails

2010-11-29 Thread Frederick Cheung
On Nov 29, 3:25 pm, PalaniKannan K wrote: > hi, > > <% @sp_references.each do |sp_ref| %> >  <% sp_ref.all_references.each_with_index do |tax_ref, i| %> >   <%if (tax_ref.reference.uniq) && (tax_ref.reference !~ /emend$/i) %> >    <%= tax_ref.reference %> >   <%end%> >  <%end%> > <%end%> > > Thi