README: Add missing `end` and improve explanation

in Scopes/Class Methods section.

[skip ci]
This commit is contained in:
Jon Atack 2014-09-11 19:02:12 +02:00
parent 8e72535710
commit 85b3d397c3
1 changed files with 3 additions and 2 deletions

View File

@ -415,13 +415,14 @@ class Employee < ActiveRecord::Base
def self.ransackable_scopes(auth_object = nil)
if auth_object.try(:admin?)
# admins may search on all three methods
# allow admin users access to all three methods
%i(active hired_since salary_gt)
else
# in this example, non-admin users may not search by salary
# allow other users to search on active and hired_since only
%i(active hired_since)
end
end
end
Employee.search({ active: true, hired_since: '2013-01-01' })