README.md in yaaf-0.1.0 vs README.md in yaaf-0.1.1
- old
+ new
@@ -1,18 +1,19 @@
-# YAAF
+
-
-[](https://codeclimate.com/github/rootstrap/yaaf/maintainability)
-[](https://codeclimate.com/github/rootstrap/yaaf/test_coverage)
-
YAAF (Yet Another Active Form) is a gem that let you create form objects in an easy and Rails friendly way. It makes use of `ActiveRecord` and `ActiveModel` features in order to provide you with a form object that behaves pretty much like a Rails model, and still be completely configurable.
We were going to name this gem `ActiveForm` to follow Rails naming conventions but given there are a lot of form object gems named like that we preferred to go with `YAAF`.
+
+[](https://codeclimate.com/github/rootstrap/yaaf/maintainability)
+[](https://codeclimate.com/github/rootstrap/yaaf/test_coverage)
+
## Table of Contents
- [Motivation](#motivation)
+ - [Why YAAF?](#why-yaaf)
- [Installation](#installation)
- [Usage](#usage)
- [Setting up a form object](#setting-up-a-form-object)
- [#initialize](#initialize)
- [#valid?](#valid?)
@@ -45,10 +46,26 @@
For this reason we decided to build our own Form Object implementation. After several months in production without issues we decided to extract it into a gem to share it with the community.
If you want to learn more about Form Objects you can check out [these great articles](#links).
+### Why YAAF?
+
+- It is [64 lines long](https://github.com/rootstrap/yaaf/blob/master/lib/yaaf/form.rb#L64). As you can imagine, we did no magic in such a few lines of code, we just leveraged Rails modules in order to provide our form objects with a Rails-like behavior. You can review the code, it's easy to understand.
+
+- It provides a similar API to `ActiveModel` models so you can treat them interchangeably.
+
+- You can customize it 100%. We encourage you to have your own `ApplicationForm` which inherits from `YAAF::Form` and make the customizations you'd like for your app.
+
+- It helps decoupling the frontend from the database. This is particularly important when using Rails as a JSON API with a frontend in React/Ember/Vue/Angular/you name it. If you were to use `accepts_nested_attributes_for` your frontend would need to know your database structure in order to build the request. With `YAAF` you can provide a the interface you think it's best.
+
+- It easily supports nested models, collection of models and associated models. You have full control on their creation.
+
+- It helps you keep your models, views and controllers thin by providing a better place where to put business logic. In the end, this will improve the quality of your codebase and make it easier to maintain and extend.
+
+- It is an abstraction from production code. It has been working well for us, I'm confident it will work well for you too :)
+
## Installation
Add this line to your application's Gemfile:
```ruby
@@ -244,10 +261,11 @@
- [Form Objects Design Pattern](https://gorails.com/episodes/form-objects-design-pattern)
- [Form Object from Railscasts](https://makandracards.com/alexander-m/42271-form-object-from-railscasts)
- [Validating Form Objects](https://revs.runtime-revolution.com/validating-form-objects-8058fefc7b89)
- [Disciplined Rails: Form Object Techniques & Patterns — Part 1](https://medium.com/@jaryl/disciplined-rails-form-object-techniques-patterns-part-1-23cfffcaf429)
- [Complex form objects with Rails](https://www.codementor.io/@victor_hazbun/complex-form-objects-in-rails-qval6b8kt)
+- [How to keep your controllers thin with form objects](https://ducktypelabs.com/how-to-keep-your-controllers-thin-with-form-objects)
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -267,6 +285,6 @@
## Credits
YAAF is maintained by [Rootstrap](http://www.rootstrap.com) with the help of our [contributors](https://github.com/rootstrap/yaaf/contributors).
-[<img src="https://s3-us-west-1.amazonaws.com/rootstrap.com/img/rs.png" width="100"/>](http://www.rootstrap.com)
+[](http://www.rootstrap.com)