Sha256: 04ed35b574f8bdcd22bb2a953bd1ba8d367cf7232c05f79d3d24b043efe93db6
Contents?: true
Size: 997 Bytes
Versions: 6
Compression:
Stored size: 997 Bytes
Contents
module Godmin module Helpers module Application # Renders the provided partial with locals if it exists, otherwise # yields the given block. The lookup context call is cached for # each partial. def partial_override(partial, locals = {}, &block) @_partial_override ||= {} unless @_partial_override.key?(partial) @_partial_override[partial] = lookup_context.exists?(partial, nil, true) end if @_partial_override[partial] render partial: partial, locals: locals else capture(&block) end end # Wraps the policy helper so that it is always accessible, even when # authorization is not enabled. When that is the case, it returns a # policy that always returns true. def policy(resource) if authorization_enabled? super(resource) else Authorization::Policy.new(nil, nil, default: true) end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems