README.md in ii_finder-1.2.0 vs README.md in ii_finder-2.0.0
- old
+ new
@@ -139,13 +139,13 @@
Note that finder does not handle the return value of callback.
When you want to update `@relation` in the callback,
reassign `@relation` or use methods like `where!` or `order!`.
-#### Chain
+#### Coactors
-You can chain multiple finders by using `chain`. For example:
+You can chain multiple finders by using `coact`. For example:
```ruby
class NameFinder < IIFinder::Base
parameters :name
@@ -161,31 +161,17 @@
@relation.where(age: value)
end
end
class ItemsFinder < IIFinder::Base
- chain NameFinder, AgeFinder
+ coact NameFinder, AgeFinder
end
ItemsFinder.call(Item.all, name: 'name', age: 10).to_sql
#=> SELECT "items".* FROM "items" WHERE "items"."name" = 'name' AND "items"."age" = 10
```
-You can also use method or block to find finder class dynamically:
-
-```ruby
-class ItemFinder < IIFinder::Base
- chain -> { NameFinder }
-end
-
-class ItemFinder < IIFinder::Base
- chain :chain_finder
-
- def chain_finder
- NameFinder
- end
-end
-```
+See [coactive](https://github.com/kanety/coactive) for more `coact` examples:
### Lookup for model
Finder lookups related model by its class name when the first argument of `call` is not relation.
So the name of finder class should be composed of the name of model class.