3 ms·
Show HN: typed_params – An alternative to strong_parameters for Ruby on Rails
- drakmail 3y agoGreat gem! Can I define a several optional parameters where one of parameters is required? For example, I have auth endpoint, which is used to authenticate user and user can authenticate by email and password or phone number and password, so email and password is optional, but exactly one of them should be sent. I'm quick looked at the documentation and didn't find any examples of such cases
- ezekg 3y agoIt's possible via a custom validation. I just added a test for that to showcase how: https://github.com/keygen-sh/typed_params/commit/e56fe479f26a72964fefbd5f720548f4a93f5bb6 https://github.com/keygen-sh/typed_params/commit/e56fe479f26...