Sha256: 22d9c6e267ce8903f4fe9b6fdbcba68c8a766aab27a9aaeb5ce686396c7fb1d2

Contents?: true

Size: 361 Bytes

Versions: 10

Compression:

Stored size: 361 Bytes

Contents

module DefaultSortingConcern
  extend ActiveSupport::Concern

  included do
      scope :sorting, lambda{ |options|
                attribute = options[:attribute]
                direction = options[:sorting]

                attribute ||= "id"
                direction ||= "DESC"

                order("#{attribute} #{direction}")
              }
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
beautiful_scaffold-2.0.3 lib/generators/templates/app/models/concerns/default_sorting_concern.rb
beautiful_scaffold-2.0.2 lib/generators/templates/app/models/concerns/default_sorting_concern.rb
beautiful_scaffold-2.0.1 lib/generators/templates/app/models/concerns/default_sorting_concern.rb
beautiful_scaffold-2.0.0 lib/generators/templates/app/models/concerns/default_sorting_concern.rb
beautiful_scaffold-2.0.0.pre lib/generators/templates/app/models/concerns/default_sorting_concern.rb
beautiful_scaffold-1.0.2 lib/generators/templates/app/models/concerns/default_sorting_concern.rb
beautiful_scaffold-1.0.1 lib/generators/templates/app/models/concerns/default_sorting_concern.rb
beautiful_scaffold-1.0.0.pre lib/generators/templates/app/models/concerns/default_sorting_concern.rb
beautiful_scaffold-0.3.6 lib/generators/templates/app/models/concerns/default_sorting_concern.rb
beautiful_scaffold-0.3.5 lib/generators/templates/app/models/concerns/default_sorting_concern.rb