8000 Custom Athorization Adapter Example produces error · Issue #2363 · activeadmin/activeadmin · GitHub
[go: up one dir, main page]

Skip to content
Custom Athorization Adapter Example produces error #2363
@Diosan

Description

@Diosan

The code below in app/models/scorecard_authorization.rb produces the error in browser

undefined method `normalize' for #ScorecardAuthorization:0x00000005564cd0

     class ScorecardAuthorization < ActiveAdmin::AuthorizationAdapter

      def authorized?(action, subject = nil)
        case subject
         when normalize(Person)

           # Only let the author update and delete posts
           if action == :update || action == :destroy
             subject.author == user

           # If it's not an update or destroy, anyone can view it
           else
            true
           end

         else
           true
         end
       end
     end

ActiveAdmin 0.6.0
Rails 3.2.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0