lib/active_scaffold/finder.rb
# returns a single record (the given id) but only if it's allowed for the specified security options.
# security options can be a hash for authorized_for? method or a value to check as a :crud_type
# accomplishes this by checking model.#{action}_authorized?
returns a single record (the given id) but only if it's allowed for the specified security options.
security options can be a hash for authorized_for.
returns a single record ( the given id ) but only if it ' s allowed for the specified security options . security options can be a hash for authorized_for .
def find_if_allowed(id, security_options, klass = beginning_of_chain)
      record = klass.find(id)
      security_options = {:crud_type => security_options.to_sym} unless security_options.is_a? Hash
      raise ActiveScaffold::RecordNotAllowed, "#{klass} with id = #{id}" unless record.authorized_for? security_options
      record
    end
def find_if_allowed ( id , security_options , klass = beginning_of_chain ) record = klass . find ( id ) security_options = { :crud_type => security_options . to_sym } unless security_options . is_a? Hash raise ActiveScaffold :: RecordNotAllowed , "#{klass} with id = #{id}" unless record . authorized_for? security_options record end
returns a single record (the given id) but only if it's allowed for the specified security options.
returns a single record ( the given id ) but only if it ' s allowed for the specified security options .
id
<not_specific>
security_options
<not_specific>
klass
<not_specific>
beginning_of_chain
<not_specific>