Hey guys, I have got a simple statement below which will retrieve a users details where a session has been set using their id. I want to know how I can change the statement to say instead of find everything where the id matches the session user_id to find everything where the id DOES NOT EQUAL to the session user_id. It may seem like a small change but I have no clue how to as I''m still new to RoR. Would appreciate nay suggestions. @active_user = User.find(:all, :conditions => {:id => session[:user_id]}) Regards Raj -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
@active_user = User.find(:all, :conditions => ["id <> ?", session[:user_id]]) On Sep 11, 5:53 am, Rajeev Amuthan <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hey guys, > > I have got a simple statement below which will retrieve a users details > where a session has been set using their id. I want to know how I can > change the statement to say instead of find everything where the id > matches the session user_id to find everything where the id DOES NOT > EQUAL to the session user_id. It may seem like a small change but I have > no clue how to as I''m still new to RoR. Would appreciate nay > suggestions. > > @active_user = User.find(:all, :conditions => {:id => > session[:user_id]}) > > Regards > > Raj > -- > Posted viahttp://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jeff Emminger wrote:> @active_user = User.find(:all, :conditions => ["id <> ?", > session[:user_id]]) > > On Sep 11, 5:53 am, Rajeev Amuthan <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>Cheers mate did the trick. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---