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

Possible to manually set the result #56

Closed
tfausak opened this issue Oct 15, 2013 · 0 comments
Closed

Possible to manually set the result #56

tfausak opened this issue Oct 15, 2013 · 0 comments
Assignees
Labels
Milestone

Comments

@tfausak
Copy link
Collaborator

tfausak commented Oct 15, 2013

It's possible to set the @result instance variable and then call outcome.result on an invalid outcome.

class Interaction < ActiveInteraction::Base
  boolean :attribute
  validate do
    @result = 'result'
    errors.add(:attribute, 'invalid')
  end
end
outcome = Interaction.run(attribute: true)
outcome.invalid?
# => true
outcome.result
# => "result"
@ghost ghost assigned tfausak Oct 15, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant