Sha256: 638ae58dccb44903a17d3de5f58744650c79ac945ad3f507d155afb868d147ba
Contents?: true
Size: 273 Bytes
Versions: 2
Compression:
Stored size: 273 Bytes
Contents
module ActiveHashRelation::SortFilters def apply_sort(resource, params, model = nil) if model.columns.map(&:name).include?(params[:property].to_s) resource = resource.order(params[:property] => (params[:order] || :desc) ) end return resource end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
active_hash_relation-1.1.0 | lib/active_hash_relation/sort_filters.rb |
active_hash_relation-1.0.5 | lib/active_hash_relation/sort_filters.rb |