I'm reading AASM docs and trying to decide which hook I'm going to use.
On their docs: https://github.com/aasm/aasm#extending-aasm
What does it mean by # if persist successful, database update not guaranteed here?
Can anyone explain the differences between before_success and success hooks?
Do I have to call .save if I'm modifying an attribute of the same ActiveRecord object on these hooks?
Thanks
What does it mean by db update not guaranteed of AASM hook?
115 views Asked by nanakondor At
1
There are 1 answers
Related Questions in RUBY
- how to integrate cashfree payment gateway in ruby on rails project
- RSpec Capybara throwing Selenium error when trying to click a button with browser confirm
- Duplicate GET requests - Rails & Heroku
- convert csv file with json data inside to a column, rows table in 2nd csv file
- Installing dependencies from a gemspec file
- Verifying Google Identity OAuth2 token with Ruby
- Java code of AES/GCM/NoPadding encryption algorithm with authentication tag
- How to fix error in model with gem lockbox
- Cannot install Ruby Gem on Window
- use logstash filter ,aes gcm encrypted in ruby,but cannot decrypted in java
- In Rails 7, what is the right ActiveRecord callback to use if I need to prevent (or rollback) persistance on error?
- How can I go through an array and still remove elements from it
- Nokogiri only returning 5 results
- How do I get the fullscreen mode in firefox?
- undefined group option when using branch reset group regex in Ruby
Related Questions in CALLBACK
- TelephonyCallback.CallStateListener with LiveData and ViewModel
- M-Pesa Daraja API STK Push Callback Not Triggering in Node.js Application
- Qt: running callback in the main thread from the worker thread
- Why am I getting MethodErrors when using continuous callback in Julia ODE solver?
- In Rails 7, what is the right ActiveRecord callback to use if I need to prevent (or rollback) persistance on error?
- How to get variable from GWT Callback
- How to execute code "before_serialize"? or How can I sanitize attributes before they are serialized?
- Is there a way to add a pre-hook in R?
- Understanding use of closure in callback in javascript
- How can I make firebase realtime dtabase to act as a webhook endpoint
- How do you sort a list view in Visual C++?
- Second useState doesn't update in promise chain
- How to wait for one api call to complete before making another api call without using `await` in vue pinia store
- Kotlin labmda invoke alternatve
- Sveltekit on change function not being called when added to a component
Related Questions in HOOK
- How to modify HTML in WordPress core file
- I want to use toilet to modify hook_function
- Is there a way to add a pre-hook in R?
- Vite / Rollup Static Asset Copy Hook
- Mouse hook with non-English language results in extremely laggy mouse
- Retrieve Extra parameters from Airflow Connection
- In Wordpress, I want to filter the content when a page is updated or created
- Is it possible to hook a non-configurable property like window.location.hostname, in JavaScript?
- Is there a WordPress hook that fires before post.php, from which I can get the post ID?
- Woocommerce - Hide other shipping methods if free shipping is available not working properly
- Woocommerce 8.6.1 checkout form hooks not fired
- Storing Individual Quiz Answers in LearnPress Plugin - WordPress
- runing a feature with after hooks in cucumber
- Modify redis.Cmder content in hook
- IAT hook is not working with notepad.exe on Windows
Related Questions in AASM
- Rails aasm gem: "NoMethodError: undefined method" for event method
- How can i create a state machine using on the fly using yaml configuration, where i can store and use multiple config files
- Stopping event in AASM from after callback without raising exception
- What does it mean by db update not guaranteed of AASM hook?
- Why is my AASM state machine not triggered with Rails 7 Turbo patch links?
- Ruby AASM: trigger callbacks on model update
- Rails trigger AASM event on nested associations autosave
- Is there a way to change database connection for aasm in ruby in a multi-database setup?
- AASM Callback right after creating and instance
- How to avoid defining state twice in aasm
- acts_as_state_machine helper method rails 6
- ransack + AASM: ArgumentError wrong number of arguments (given 1, expected 0)
- ActiveRecord where query not working for attributes but select method is
- AASM state machine, can guards be skipped?
- Rails AASM gem, how could you achieve substate?
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Let's assume you have an event
rundefined on your model that changes the state fromstoptorunninglike this.Then calling
instance.runwould try to change the state torunningwhich would fail if the instance is already inrunningstate. If successful, the state would have been changed on the instance in memory, but would not be saved into the database.Whereas
instance.run!would do the same, but would additionally try to save the changed state into the database. Saving the new state into the database could still fail. For example, when there is a validation failing on the record after the state change or because you updated other attributes on the instance at the same time.That said: Those callbacks are fired based on the state machine logic, not on the underlying database logic. For example,
transition successonly means that the state changed successfully on the instance in memory, not necessarily in the database too. When you want to fire a callback after the database update, then use a ActiveRecordafter_commitcallback instead.