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
Should we allow callable defaults? That way you could determine the default value at "run" time instead of "compile" time.
class Interaction < ActiveInteraction::Base time :the_time, default: Time.now def execute Time.now - the_time end end Interaction.run! # => 0.000992851 Interaction.run! # => 0.001622327
I'm imagining something like this:
class Interaction < ActiveInteraction::Base time :the_time, default: -> { Time.now } end
The text was updated successfully, but these errors were encountered:
I was thinking about this exact thing the other day. This strikes me as a reasonable approach.
Sorry, something went wrong.
Oh yeah, I forgot my rationale. This sucks:
class Interaction < ActiveInteraction::Base time :the_time, default: nil def execute self.time = Time.now unless time? end end
If we ever introduce a lambda filter, we're going to hate ourselves for this.
class Interaction < ActiveInteraction::Base function :a_lambda, default: -> { -> { 'oh god why' } } end
😆
Fix #136; allow callable defaults
d58d748
tfausak
No branches or pull requests
Should we allow callable defaults? That way you could determine the default value at "run" time instead of "compile" time.
I'm imagining something like this:
The text was updated successfully, but these errors were encountered: