Module: E9Rails::Controllers::Orderable

Extended by:
ActiveSupport::Concern
Defined in:
lib/e9_rails/controllers/orderable.rb

Overview

A hackish has_scope mixin to allow ordering by database column.

Requires has_scope and inherited_resources.

Defined Under Namespace

Modules: HelperMethods

Instance Method Summary collapse

Instance Method Details

#default_ordered_dirObject



66
67
68
# File 'lib/e9_rails/controllers/orderable.rb', line 66

def default_ordered_dir 
  'DESC' 
end

#default_ordered_onObject



62
63
64
# File 'lib/e9_rails/controllers/orderable.rb', line 62

def default_ordered_on 
  'created_at' 
end

#ordered_ifObject



70
71
72
# File 'lib/e9_rails/controllers/orderable.rb', line 70

def ordered_if 
  params[:action] == 'index' 
end