Commit ef4ba8d3 authored by http://jneen.net/'s avatar http://jneen.net/

add .internal and .non_internal scopes

parent b88314f4
...@@ -354,8 +354,20 @@ class User < ActiveRecord::Base ...@@ -354,8 +354,20 @@ class User < ActiveRecord::Base
end end
end end
def self.internal_attributes
[:ghost]
end
def internal? def internal?
ghost? self.class.internal_attributes.any? { |a| self[a] }
end
def self.internal
where(Hash[internal_attributes.zip([true] * internal_attributes.size)])
end
def self.non_internal
where(Hash[internal_attributes.zip([false] * internal_attributes.size)])
end end
# #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment