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

Lazy invalid defaults get silently converted to nil #296

Closed
tfausak opened this issue Jul 30, 2015 · 3 comments · Fixed by #297
Closed

Lazy invalid defaults get silently converted to nil #296

tfausak opened this issue Jul 30, 2015 · 3 comments · Fixed by #297
Assignees
Labels

Comments

@tfausak
Copy link
Collaborator

tfausak commented Jul 30, 2015

I discovered that setting a default to a lazy value of the wrong type silently converts it to nil instead of raising an error. For example:

class Example < ActiveInteraction::Base
  boolean :a_boolean,
    default: -> { Object.new }

  def execute
    inputs
  end
end

Example.run!
# => {:a_boolean=>nil}

That should be raising an InvalidDefaultError, as it would when default: Object.new.

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

:(

@tfausak
Copy link
Collaborator Author

tfausak commented Jul 30, 2015

I probably introduced this regression in #271.

@tfausak
Copy link
Collaborator Author

tfausak commented Jul 30, 2015

In particular, I think #271 and #265 conspired to create this regression.

tfausak added a commit that referenced this issue Jul 30, 2015
tfausak added a commit that referenced this issue Aug 3, 2015
Raise InvalidDefaultError instead of silently converting to nil
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 a pull request may close this issue.

2 participants