Help doing a dynamic sort?
        Posted  
        
            by Kevin
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Kevin
        
        
        
        Published on 2010-06-05T07:45:36Z
        Indexed on 
            2010/06/05
            7:52 UTC
        
        
        Read the original article
        Hit count: 187
        
- I have a notifications table which contains different types of notifications for different events.
- Inside the table is a notifications_type:stringcolumn that contains the type of notification, i.e. "foo" or "bar" or "oof"
- I want the user to be able to select what notifications they want to display, so there are checkboxes below the result that correspond to prefs_display_foo:boolean, prefs_display_bar:booleanin the User model.
- What is an elegant way for me to set the :conditionsin the find to properly display the sorted results? Also, currently I have it as a method in the user, but how would I do it as ahas_many :notifications, :conditions => .....
© Stack Overflow or respective owner