Git Product home page Git Product logo

Comments (8)

deemytch avatar deemytch commented on June 4, 2024 2

Где были мои глаза?
Володя, спасибо!

from workflow.

geekq avatar geekq commented on June 4, 2024

You are right: to use the latest workflow gem in version 2 or later, all persistence libraries, e.g. workflow-sequel need to be updated.

  1. You can provide a fix to workflow-sequel (they have instructions on Contributing)
    or implement your own persistence as described in
    https://github.com/geekq/workflow#custom-workflow-state-persistence
  2. You can try using older version of workflow. It is still available in github and via rubygems. Please read https://github.com/geekq/workflow#state-persistence-with-activerecord

from workflow.

deemytch avatar deemytch commented on June 4, 2024

Владимир, but the bug that I opened is about that persistence with sequel, exactly as described in docs does not works. And I can't get why.

from workflow.

geekq avatar geekq commented on June 4, 2024
  1. UniqueViolation... Ключ "(id)=(2)" уже существует looks like a record with the same id already exists. Does error happens directly on Sequelbag.create ? Is it supposed to save the record immediately? persist_workflow_state should not cause this since it is not called for new records but only in process_event! https://github.com/geekq/workflow/blob/develop/lib/workflow.rb#L97-L125

  2. Can you please provide a complete minimal application (if it is a Rails-Application) or even a self-contained single-file script demonstrating the problem + Gemfile so I can easily reproduce?

from workflow.

deemytch avatar deemytch commented on June 4, 2024

Yes, and this appears when updating exisiting record and only when the class contains include Workflow. I will make the script soon.

from workflow.

deemytch avatar deemytch commented on June 4, 2024

https://github.com/deemytch/workflow-sequel-bag
Edit createdb.sql and sequelbag.rb if you need to change user/password/database.
Run main.sh there.

from workflow.

geekq avatar geekq commented on June 4, 2024

👍 was able to reproduce.

Now try to change state name from :new to something else like :neww and see what happens!

from workflow.

geekq avatar geekq commented on June 4, 2024

Background: if you define some workflow states and events, a bunch of convinience methods are created behind the scene. Looks like one of them collides with the methods used by the Sequel::Model implementation - likely new?

How I debugged:

  1. run your script - can reproduce the problem
  2. commented out actions in persitence callbacks like persist_workflow_state, before_validation etc. Problem was still there.
  3. removed everything workflow-related - problem diappeared
  4. added include Workflow - still works
  5. added workflow_column and an empty workflow do block - still works
  6. added states one by one starting with the last one - only the :new state had a problem
  7. rename the state

I should probably mention it in the documentation.

from workflow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.