minor cleanup
This commit is contained in:
parent
78a000a0b8
commit
39bb9b77de
2 changed files with 3 additions and 7 deletions
|
|
@ -166,7 +166,8 @@ class Story < ActiveRecord::Base
|
|||
def check_tags
|
||||
(self.tags_to_add || []).each do |t|
|
||||
if !t.valid_for?(self.user)
|
||||
raise "#{self.user.username} does not have permissions to use privileged tags"
|
||||
raise "#{self.user.username} does not have permission to use " <<
|
||||
"privileged tag #{t.tag}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,13 +1,8 @@
|
|||
class Tag < ActiveRecord::Base
|
||||
attr_accessor :filtered_count
|
||||
|
||||
# Scope to determine what tags a user can see
|
||||
scope :accessible_to, ->(user) do
|
||||
if user.is_admin?
|
||||
all
|
||||
else
|
||||
where(:privileged => false)
|
||||
end
|
||||
user.is_admin?? all : where(:privileged => false)
|
||||
end
|
||||
|
||||
def self.all_with_filtered_counts_for(user)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue