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

Allow nil for interfaces and models #265

Merged
merged 3 commits into from Mar 16, 2015
Merged

Allow nil for interfaces and models #265

merged 3 commits into from Mar 16, 2015

Conversation

tfausak
Copy link
Collaborator

@tfausak tfausak commented Mar 12, 2015

Fixes #263.

class InterfaceInteraction < ActiveInteraction::Base
  interface :anything

  def execute
    anything
  end
end

InterfaceInteraction.run!(anything: nil)
# master
#   ActiveInteraction::NoDefaultError: anything
# gh-263
#   => nil

class ModelInteraction < ActiveInteraction::Base
  model :object

  def execute
    object
  end
end

ModelInteraction.run!(object: nil)
# master
#   ActiveInteraction::NoDefaultError: object
# gh-263
#   => nil

@tfausak tfausak self-assigned this Mar 12, 2015
@tfausak tfausak added the bug label Mar 12, 2015
@AaronLasseigne
Copy link
Owner

I'm not entirely clear on this. Why would we allow nil without a default being set?

@tfausak
Copy link
Collaborator Author

tfausak commented Mar 12, 2015

Because nil is an appropriate value. If you have an interface filter with no methods, nil implements that interface. If you have a model filter for Object, nil is an Object.

@tfausak
Copy link
Collaborator Author

tfausak commented Mar 16, 2015

Can I get a :shipit:?

@AaronLasseigne
Copy link
Owner

:shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Running an interaction with an interface filter can raise an error
2 participants