Skip to content

NoMethodError, when creating a new User #270

Closed
@r3id

Description

Configuration

  • Sorcery Version: 0.15.0
  • Ruby Version: 3.0.0
  • Framework: Rails 6.1.1
  • Platform: macOS 11.1

Expected Behavior

A new user is meant to be created.

Actual Behavior

Since updating to sorcery 0.15.0 I am getting the following error when I try to run User.create in the rails console.

NoMethodError (undefined method `after_save' for {:if=>#<Proc:0x00007fcb22b96cd0 /Users/alan/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sorcery-0.15.0/lib/sorcery/model.rb:69>}:Hash)

Steps to Reproduce

See below for when I run the User.create

irb(main):001:0> user = User.create(email: 'alan@example.com')
  TRANSACTION (0.1ms)  BEGIN
  User Exists? (1.1ms)  SELECT 1 AS one FROM "users" WHERE "users"."slug" = $1 LIMIT $2  [["slug", "8c8b4b303a"], ["LIMIT", 1]]
  User Create (0.9ms)  INSERT INTO "users" ("slug", "email", "created_at", "updated_at") VALUES ($1, $2, $3, $4) 
  RETURNING "id"  [["slug", "8c8b4b303a"], ["email", "alan@example.com"], 
                                  ["created_at", "2021-01-18 12:05:58.962942"], 
                                  ["updated_at", "2021-01-18 12:05:58.962942"]]
  TRANSACTION (0.2ms)  ROLLBACK
Traceback (most recent call last):
        1: from (irb):1:in `<main>'
NoMethodError (undefined method `after_save' for {:if=>#<Proc:0x00007fcb22b96cd0
/Users/alan/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/sorcery-0.15.0/lib/sorcery/model.rb:69>}:Hash)

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions