orbit disable object for categories

This commit is contained in:
Matthew K. Fu JuYuan committed 2012-07-05 16:00:45 +08:00
1 parent edef51d58c
commit c5fdff764e
20 files changed
+89 -46

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
module OrbitControllerLib
module DivisionForDisable
def get_disable_object_by_user(object_class)
if is_admin? or is_manager?
object_class.admin_manager_all
else
object_class.all
end
end
end
end
+15
View File
@@ -1,4 +1,19 @@
module OrbitCoreLib
module ObjectDisable
def self.included(base)
base.instance_eval("field :disable,type: Boolean,:default => false")
base.instance_eval("scope :all,where(disable: false)")
base.instance_eval("scope :admin_manager_all,find(:all)")
base.define_singleton_method :find do |*args|
if args ==[:all]
unscoped
else
unscoped.find(args)
end
end
end
end
module ObjectAuthable
def self.included(base)
base.instance_eval("has_many :object_auths,as: :obj_authable,dependent: :delete")