Sha256: addec651d4dc7ef9ee0d58dd411316d2976fa6b6e98dfb3667b6d73be6056dd6

Contents?: true

Size: 422 Bytes

Versions: 10

Compression:

Stored size: 422 Bytes

Contents

module ActiveRecord
  module SecureMethods

    protected

    def check_creator(user)
      check(user, :creator_id)
    end

    def check_user(user)
      check(user, :user_id)
    end

    def check_sharer(user)
      check(user, :shared_by_id)
    end
 
    def check(user, field)
      if user && user != :false
        self.send(field) == user.id || user.admin?
      else
        false
      end
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
muck-users-0.1.4 lib/active_record/secure_methods.rb
muck-users-0.1.5 lib/active_record/secure_methods.rb
muck-users-0.1.6 lib/active_record/secure_methods.rb
muck-users-0.1.7 lib/active_record/secure_methods.rb
muck-users-0.1.8 lib/active_record/secure_methods.rb
muck-users-0.1.9 lib/active_record/secure_methods.rb
muck-users-0.1.10 lib/active_record/secure_methods.rb
muck-users-0.1.11 lib/active_record/secure_methods.rb
muck-users-0.1.12 lib/active_record/secure_methods.rb
muck-users-0.1.3 lib/active_record/secure_methods.rb