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: 155

Filed under:
|
|
  • 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 => .....

© Stack Overflow or respective owner

Related posts about sql

Related posts about ruby-on-rails