category disable for backend
This commit is contained in:
1 parent
c5fdff764e
commit
56caf4b34e
13 files changed
+190
-88
No files matched your search
+12
-1
@@ -5,13 +5,24 @@ module OrbitCoreLib
|
||||
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)
|
||||
res = unscoped.find(args)
|
||||
res.count == 1 ? res[0] : res
|
||||
end
|
||||
end
|
||||
|
||||
base.define_singleton_method :first do |*args|
|
||||
all.first
|
||||
end
|
||||
|
||||
base.define_singleton_method :last do |*args|
|
||||
all.last
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
module ObjectAuthable
|
||||
|
||||
Reference in new issue
Block a user