luckyframework / website-old

The old website for Lucky (archived)
https://github.com/luckyframework/website-v2
MIT License
11 stars 29 forks source link

Method reference for BaseForm, Avram::Form, Avram::Field, etc #226

Open ditsara opened 5 years ago

ditsara commented 5 years ago

Coming from Rails to Lucky/Crystal, I think it'd be useful to have a reference in the guides for the macro-generated methods. Having a top-level understanding of the magic that's happening inside the macros would really help with getting people started.

For example, see: https://guides.rubyonrails.org/association_basics.html#detailed-association-reference

Classes that could be documented:

Happy to write/contribute if others think this is a good idea.

paulcsmith commented 5 years ago

I think this is a fantastic idea! I'd love some help with this. It may be hard to track down everything, but if you get it started and open a PR I'm happy to fill in the gaps or point to files/methods that need some work.

Thanks so much for opening this!

jonnypetraglia commented 5 years ago

I was about to file the same issue regarding forms, specifically feedback with errors; presently under "Saving Data with Forms", it only mentions .valid? and .saved? which isn't enough to tell what the error was if there was one.

I'm not quite sure how the best way to go about that would be but I believe mentioning something about errors and fields and how to use them. I think maybe it could be something similar to the reduce usage in Avram::FormErrors

https://github.com/luckyframework/avram/blob/701c31087a7cb41c7eed0cb4b111f1f013a27f45/src/avram/form_errors.cr

And I know the guide says "They return a Avram::Field that contains the value of the field, the name of the field, the param value, and any errors the field has." but I guess for me, if it's not specified as errors, I interpret it as being part of the sentence, not a callable method.