Sha256: 03589abf8368c87a719ea36694be43872a51c3742fb5f583130e7cfc7a1f9768

Contents?: true

Size: 302 Bytes

Versions: 13

Compression:

Stored size: 302 Bytes

Contents

module Pulitzer
  module PostTypeElement
    def self.included(klass)
      klass.before_save :handle_sort_order
    end

    def highest_sibling_sort
      self.post_type.highest_element_sort
    end

    def handle_sort_order
      self.sort_order ||= self.highest_sibling_sort + 1
    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
pulitzer-0.14.4 app/models/pulitzer/post_type_element.rb
pulitzer-0.14.3 app/models/pulitzer/post_type_element.rb
pulitzer-0.14.2 app/models/pulitzer/post_type_element.rb
pulitzer-0.14.1 app/models/pulitzer/post_type_element.rb
pulitzer-0.14.0 app/models/pulitzer/post_type_element.rb
pulitzer-0.13.1 app/models/pulitzer/post_type_element.rb
pulitzer-0.12.5 app/models/pulitzer/post_type_element.rb
pulitzer-0.13.0 app/models/pulitzer/post_type_element.rb
pulitzer-0.12.4 app/models/pulitzer/post_type_element.rb
pulitzer-0.12.3 app/models/pulitzer/post_type_element.rb
pulitzer-0.12.2 app/models/pulitzer/post_type_element.rb
pulitzer-0.12.1 app/models/pulitzer/post_type_element.rb
pulitzer-0.12.0 app/models/pulitzer/post_type_element.rb