Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RethinkDB/NoBrainer compatibility? #521

Closed
zedtux opened this issue Jan 11, 2018 · 2 comments
Closed

RethinkDB/NoBrainer compatibility? #521

zedtux opened this issue Jan 11, 2018 · 2 comments

Comments

@zedtux
Copy link
Contributor

zedtux commented Jan 11, 2018

I'm working on a Rails 5 application, using the RethinkDB with the nobrainer ORM and I wrote the following model:

class Request
  include NoBrainer::Document
  include AASM

  before_create :populates_created_at

  field :url, type: String
  field :created_at, type: Time
  field :state, type: String

  aasm column: :state do
    state :pending, initial: true
    state :running
    state :succeeded
    state :failed

    event :run do
      transitions from: :pending, to: :running
    end

    event :succeed do
      transitions from: :running, to: :succeeded
    end

    event :fail do
      transitions from: :running, to: :failed
    end
  end

  private

  def populates_created_at
    self.created_at = Time.zone.now
  end
end

Unfortunately, the AASM doesn't seem to work as the :state column isn't field in at all, and executing .run! doesn't seem to do anything.

How could I figure out what's going wrong?

@zedtux
Copy link
Contributor Author

zedtux commented Jan 11, 2018

Oh I guess something similar to lib/aasm/persistence/mongoid_persistence.rb should be done?

@zedtux
Copy link
Contributor Author

zedtux commented Jan 22, 2018

This issue will be closed by #522

@zedtux zedtux closed this as completed Feb 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant