Module: Para::ActiveRecordOrderableMixin::ClassMethods

Defined in:
lib/para/orderable.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_orderable(options = {}) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/para/orderable.rb', line 55

def acts_as_orderable(options = {})
  return if orderable?

  unless (
    ( options[:parent] &&  options[:as]) ||
    (!options[:parent] && !options[:as])
  )
    raise "You need to either pass :parent and :as options to the " \
          "acts_as_orderable macro, or no options at all."
  end

  self.orderable = true
  self._orderable_options = options
  include Para::Orderable
end

#orderable?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/para/orderable.rb', line 71

def orderable?
  !!orderable
end