We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The following code raises NameError error, because the result variable is defined only in the transaction scope.
NameError
result
ActiveRecord::Base.transaction do result = 1 end result # NameError: undefined local variable or method `result'
To fix it I need:
result = nil ActiveRecord::Base.transaction do result = 1 end result
result = ActiveRecord::Base.transaction do 1 end
ActiveRecord::Base.transaction do @result = 1 end @result
Which way is better?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The following code raises
NameError
error, because theresult
variable is defined only in the transaction scope.To fix it I need:
result
variable before the transaction blockresult
variable:Which way is better?
The text was updated successfully, but these errors were encountered: