-
Notifications
You must be signed in to change notification settings - Fork 139
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
Easier fetching of given inputs #498
Comments
This seems like a good idea. Do you still want to take a shot at making a PR? |
Cool! Yes I’ll give it a shot. :) |
I've been looking at this at it might actually be tricky to do. There are some changes I'm wanting to make under the hood that will make this easier. Let's put a pause on it and I'll let you know when I've done the internal stuff. |
Hi @AaronLasseigne. It was really cool to see the 5.0 upgrade. I have this piece of code in a superclass that all my interactions inherit from:
I'm trying to achieve the same functionality with the 5.0 upgrade but I can't seem to find a good way to do that. With the 5.0 upgrade and move of |
I'm wondering about how this should work for hashes. Should it only be the first level of inputs or should it dive deep into hashes and check those too? |
IMO it should just be the first level of inputs. |
Sure, we'll start with just the top level of inputs and see what people think. |
Hi!
I recently started using AI and I've run into what seems like a topic that has already been discussed a few times: partial updates by using
default: nil
andgiven?(:my_attribute)
.When reading previous issues I see that there's some pushback around using something like
optional: true
with the result that if an argument is optional and not passed to the interaction it is not present in theinputs
hash. Fair enough.I find myself doing something like
in order to support partial updates which works but is not super friendly.
How do you feel about adding a
given
method inActiveInteraction::Inputs
that returns a newActiveInteraction::Inputs
instance but only containing the keys that was given? It would make the above use case look likewhich imo is pretty slick 😎
I'm not familiar with this codebase yet but if you like the idea and would accept a pull request I could take a shot at it.
For the record: I do feel having something like
optional: true
would be great :)The text was updated successfully, but these errors were encountered: