Help doing a dynamic sort?
- by Kevin
I have a notifications table which contains different types of notifications for different events.
Inside the table is a notifications_type:string column 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:boolean in the User model.
What is an elegant way for me to set the :conditions in 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 a has_many :notifications, :conditions = .....