conditions without repeats
        Posted  
        
            by Luca Romagnoli
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Luca Romagnoli
        
        
        
        Published on 2010-05-20T20:32:05Z
        Indexed on 
            2010/05/20
            22:20 UTC
        
        
        Read the original article
        Hit count: 217
        
Hi i'm using this for getting data:
Topic.find(:all, :include => ...,
:conditions => @core ? ["cores_topics.id = ? AND visible = 1 AND (distance < ? OR cores.id IN (?))",@core.id, @user_location[3].to_i, @user_friends] : 
["visible = 1 AND (distance < ? OR cores.id IN (?))", @user_location[3].to_i, @user_friends], 
...
how can i rewrite the conditions shorter?
thanks
© Stack Overflow or respective owner