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

Remove the "nested attributes" feature #31

Open
nicolasblanco opened this issue Dec 7, 2016 · 5 comments
Open

Remove the "nested attributes" feature #31

nicolasblanco opened this issue Dec 7, 2016 · 5 comments

Comments

@nicolasblanco
Copy link
Owner

I'm thinking of removing the "nested attributes" feature to stay in the philosophy of a minimalist gem.

To validate nested attributes you can do this easily with an ActiveModel::Model class. Also you can validate the presence of the nested objects using Strong parameters and the require method on the params object.

If you have any opinion on this, please comment!

@adis-io
Copy link

adis-io commented Dec 7, 2016

Personally I need this feature.

@nicolasblanco
Copy link
Owner Author

@adisos : that's great if you like nested attributes. Please be a little more detailed and explain why you cannot or don't want to use the built-in Rails ActiveModel::Model module to validate nested objects?

Why should we reinvent the wheel? Rails philosophy is all about DRY, right?

@adis-io
Copy link

adis-io commented Dec 8, 2016

I really don't like AM. I'm using Trailblazer for complex forms and also dry-validation. And this gem is really cool for fast development.

@imi56
Copy link

imi56 commented Jun 18, 2018

This library should not be used to validate a large number of parameters or parameters....
Please define large number.

@ximus
Copy link

ximus commented Aug 3, 2018

rails_params is very usefully for validating bodies and url parameters for basic APIs, and so far works quite well. APIs can have more involved input structures than traditional controllers that just render HTML, and it's not rare for data to be nested at more than one level.

This is seems like a primitive feature of any web input validation library and I think it should stay IMO. I think the minimalist philosophy is nice, but I think there is more value in allowing this feature to remain. Also worth noting that it still feels quite minimalist even with recursion

about Strong parameters: it can validate presence, but doesn't help with types and hence quickly becomes useless beyond the basic security contraints it provides.
about ActiveModel: i've found it to be less elegant to use than rails_param. with rails_params, it's trivial to keep the input schema nicely collocated with the controller action, and expressed in more clear and minimal way that AM.

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

No branches or pull requests

4 participants