Skip to content

ActionController::InvalidAuthenticityToken when using hooks #551

@stefatkins

Description

@stefatkins

Expected behavior

When I use smart action hook (load). I would like to execute the code that is written.

Actual behavior

When I click on my smart action a POST to /forest/actions/deny-document/hooks/loadis sent but I get an ActionController::InvalidAuthenticityToken error. This does work on a local environnent.

Failure Logs

Capture d’écran 2022-03-29 à 18 24 57

Code

class Forest::Document
  include ForestLiana::Collection
  collection :Document

  action 'Deny Document', type: 'single',
                          fields: [
                            {
                              field: 'denial_reason',
                              type: 'Enum',
                              description: 'Please select the reason of the denial',
                              enums: ["reason1", "reason2"],
                              is_required: true,
                              hook: 'on_denial_reason_changed'
                            }
                          ],
                          hooks: {
                            load: lambda { |context|
                              puts "hello"
                            },
                            change: {
                              'on_denial_reason_changed' => lambda { |context|
                                puts "changed"
                              }
                            }
                          }
end

Context

  • Package Version: 7.4.1
  • Rails Version: 6.1.4.7
  • Database Dialect: Postgres
  • Database Version: 14.2

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