Cross Reference: scope_builder.rb
xref
: /
ontohub
/
lib
/
scope_builder.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
module
ScopeBuilder
extend
ActiveSupport
::
Concern
included
do
# DEFAULT SCOPES --------------------------------------
# excludes the given ids
scope
:
without_ids
, ->
(
ids
)
{
ids
=
ids.to_s.split
(
","
)
unless
ids.is
_a
?
(
Array
)
where
"id NOT IN (?)"
,
ids
}
end
module
ClassMethods
def
equal_scope
(*
attributes
)
attributes.each
do
|
attr
|
scope
attr
, ->
(
val
)
{
where
attr
=>
val
}
end
end
end
end