Sha256: d854ea413c9942c68193371866d4b7ec1082753d39cf85e002dc9503d41897ed
Contents?: true
Size: 754 Bytes
Versions: 18
Compression:
Stored size: 754 Bytes
Contents
# ========================================================================== # # IMPORTANT: this default value raises "stack level too deep" if concern is # included for existing objects, to fix issue update _position # value for all objects like this: # # > ModelClass.all.set(_position: 1000) # # ========================================================================== module Ants module Orderable extend ActiveSupport::Concern included do # attributes field :_position, type: Float, default: -> { (self.class.all.last.try(:_position) || 1000) + 10 } # scopes default_scope -> { order_by(_position: :asc) } # helpers index({ _position: 1 }) end end end
Version data entries
18 entries across 18 versions & 1 rubygems