README.md in materialist-2.0.0 vs README.md in materialist-2.1.0

- old
+ new

@@ -116,10 +116,14 @@ class ZoneMaterializer include Materialist::Materializer persist_to :zone + source_key :source_id do |url| + /(\d+)\/?$/.match(url)[1] + end + capture :id, as: :orderweb_id capture :code capture :name link :city do @@ -140,10 +144,16 @@ #### `persist_to <model_name>` describes the name of the active record model to be used. If missing, materialist skips materialising the resource itself, but will continue with any other functionality -- such as `materialize_link`. + +#### `source_key <column> <url_parser_block> (default: url)` +describes the column used to persist the unique identifier parsed from the url_parser_block. +By default the column used is `:source_url` and the original `url` is used as the identifier. +Passing an optional block allows you to extract an identifier from the URL. + #### `capture <key>, as: <column> (default: key)` describes mapping a resource key to a database column. #### `capture_link_href <key>, as: <column>` describes mapping a link href (as it appears on the hateous response) to a database column. @@ -167,10 +177,10 @@ after_upsert :my_method, :my_second_method def my_method(record) end - + def my_second_method(record) end end ```