Fix pagination. Refs #2136

This commit is contained in:
Pavel Chipiga 2011-10-29 12:33:09 +03:00
parent b55a99adfa
commit ec9d14822e
1 changed files with 2 additions and 2 deletions

View File

@ -120,7 +120,7 @@ class ActiveRecord::Base
class << self class << self
def visible_to object def visible_to object
return all unless (public_instance_methods + column_names).include? 'visibility' return scoped unless (public_instance_methods + column_names).include? 'visibility'
rs = (object.roles_to :system).compact rs = (object.roles_to :system).compact
vis = rs.inject({}) do |h, r| vis = rs.inject({}) do |h, r|
unless r.can_see.nil? unless r.can_see.nil?
@ -131,7 +131,7 @@ class ActiveRecord::Base
vis = vis[self.name] vis = vis[self.name]
return [] if !vis or vis.empty? return [] if !vis or vis.empty?
if vis == self::VISIBILITIES if vis == self::VISIBILITIES
return all return scoped # all
else else
return by_visibilities(vis) return by_visibilities(vis)
end end