Sha256: 50a04565d27fde77c59047139acae5e1cca291c608d72d94669bdddf2757b7db

Contents?: true

Size: 867 Bytes

Versions: 5

Compression:

Stored size: 867 Bytes

Contents

class Node
  module Sugar
    extend ActiveSupport::Concern

    included do
      PerPageOff = 10000
    end

    def pagination_off!
      settings.find_or_create_by_key('per_page') { |s| s.value = PerPageOff }
    end

    def undeleteable!
      settings.find_or_create_by_key('can_delete') { |s| s.value = false }
    end

    def fields(config)
      settings.find_or_create_by_key('include_fields') { |s| s.value = config[:only] } if config[:only]
      settings.find_or_create_by_key('exclude_fields') { |s| s.value = config[:except] } if config[:except]
    end

    def fieldsets(config)
      settings.find_or_create_by_key('include_fieldsets') { |s| s.value = config[:only] } if config[:only]
      settings.find_or_create_by_key('exclude_fieldsets') { |s| s.value = config[:except] } if config[:except]
    end

    module ClassMethods
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
qwerty-0.0.7.pre app/models/node/sugar.rb
qwerty-0.0.5.pre app/models/node/sugar.rb
qwerty-0.0.4.pre app/models/node/sugar.rb
qwerty-0.0.3.pre app/models/node/sugar.rb
qwerty-0.0.1.pre app/models/node/sugar.rb