forest-rails icon indicating copy to clipboard operation
forest-rails copied to clipboard

ActionController::InvalidAuthenticityToken when using hooks

Open stefatkins opened this issue 4 years ago • 0 comments

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

stefatkins avatar Mar 29 '22 16:03 stefatkins