Module: ActsPermissive::PermissiveObject::ClassMethods

Defined in:
lib/acts_permissive/permissive_object.rb

Instance Method Summary collapse

Instance Method Details

#is_used_permissively(*args) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/acts_permissive/permissive_object.rb', line 9

def is_used_permissively *args
  options = args.extract_options!
  options.assert_valid_keys(:active_resource)

  include   ActsPermissive::PermissiveObject::InstanceMethods

  if options[:active_resource]
    include ActsPermissive::PermissiveObject::ActiveResourceSafeMethods
  else
    has_many  :circlings, :as => :circleable, :class_name => "ActsPermissive::Circling", :dependent => :destroy
    has_many  :circles, :through => :circlings, :class_name => "ActsPermissive::Circle"
    send :include, ActsPermissive::PermissiveObject::ActiveRecordSafeMethods
  end
end