On Sep 19, 2012, at 3:02 PM, Werner wrote:

> Hi Javier..
> 
> I want to show all entries..they have different other attributes but the same 
> user (name)..thats why group_by is not what I can use.
> Just want to mark them 'bold' ..so I need a true/false for every result item..

You could do this with JavaScript pretty easily. Assuming you have a UL full of 
results, your code could look like this (Prototype.js):

        var users = $$('#my_list li');
        users.each(function(elm){
                if(elm.siblings().include(function(s){ return s.innerHTML == 
elm.innerHTML; }).length > 0){
                        elm.addClassName('multiple');
                }
        });

Walter

> Thanks so far..
> 
> Werner
> 
> 
> 
> On Wednesday, September 19, 2012 8:45:11 PM UTC+2, Ruby-Forum.com User wrote:
> Javier Quarite wrote in post #1076666: 
> > Maybe this helps: 
> > 
> > http://api.rubyonrails.org/classes/Enumerable.html#method-i-group_by 
> > http://railscasts.com/episodes/29-group-by-month 
> > 
> > You may do @users.group_by(&:id) ... but I'm not sure what you have in 
> > 
> 
> Each user has a unique id, so what does that get you?  Groups with one 
> user per group. 
> 
> -- 
> 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 post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/rubyonrails-talk/-/WXndXijvj20J.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
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-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to