Module: Tablesorter::ActiveRecord
- Defined in:
- lib/tablesorter/active_record.rb
Instance Method Summary collapse
Instance Method Details
#table_sort(sort_attr, dir_attr, default_sort, default_dir) ⇒ Object
3 4 5 6 7 |
# File 'lib/tablesorter/active_record.rb', line 3 def table_sort(sort_attr, dir_attr, default_sort, default_dir) sort = sort_attr.presence || default_sort dir = dir_attr.presence || default_dir self.order("#{sort} #{dir}") end |