You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: I know that there exists a with_lock method that reloads the current instance of the transaction object, but this is a simplified example. In the real world scenario I sometimes need to lock multiple rows across multiple tables (with SQL joins) and in that case I have to overwrite the variable.
Anyways, back the point. When you assign a local variable shares the same as an input, things get really funking. I think it's because transaction= is define by AI::Base wherein it perform the coercion? Is there a (nice) workaround for this other than renaming the variable?
The text was updated successfully, but these errors were encountered:
Great question! I I don't think I've ever encountered this problem, so I don't have a solution off the top of my head. In general I try to think of the interaction inputs as immutable constants.
ActiveInteraction does define attr_accessor for each input. It doesn't do any coercion there, though. You should be able to freely re-assign values in your execute block. What exactly is the problem you're hitting?
I sometimes have something like this:
Note: I know that there exists a
with_lock
method that reloads the current instance of thetransaction
object, but this is a simplified example. In the real world scenario I sometimes need to lock multiple rows across multiple tables (with SQL joins) and in that case I have to overwrite the variable.Anyways, back the point. When you assign a local variable shares the same as an input, things get really funking. I think it's because
transaction=
is define by AI::Base wherein it perform the coercion? Is there a (nice) workaround for this other than renaming the variable?The text was updated successfully, but these errors were encountered: