README.md in hanami-model-0.7.0 vs README.md in hanami-model-1.0.0.beta1
- old
+ new
@@ -125,11 +125,11 @@
* Confines persistence logic at a low level
* Multiple data sources can easily coexist in an application
-When a class includes `Hanami::Repository`, it will receive the following interface:
+When a class inherits from `Hanami::Repository`, it will receive the following interface:
* `#create(data)` – Create a record for the given data (or entity)
* `#update(id, data)` – Update the record corresponding to the given id by setting the given data (or entity)
* `#delete(id)` – Delete the record corresponding to the given id
* `#all` - Fetch all the entities from the relation
@@ -205,28 +205,28 @@
attribute :name, from: :s_name
attribute :age, from: :i_age
end
end
```
-**NOTE:** This feature should be used only when **_automapping_** fails because the naming mismatch.
+**NOTE:** This feature should be used only when **_automapping_** fails because of the naming mismatch.
### Conventions
* A repository must be named after an entity, by appending `"Repository"` to the entity class name (eg. `Article` => `ArticleRepository`).
### Thread safety
**Hanami::Model**'s is thread safe during the runtime, but it isn't during the loading process.
-The mapper compiles some code internally, be sure to safely load it before your application starts.
+The mapper compiles some code internally, so be sure to safely load it before your application starts.
```ruby
Mutex.new.synchronize do
Hanami::Model.load!
end
```
-**This is not necessary, when Hanami::Model is used within a Hanami application.**
+**This is not necessary when Hanami::Model is used within a Hanami application.**
## Features
### Timestamps
@@ -256,10 +256,29 @@
user = repository.update(user.id, age: 34)
puts user.created_at.to_s # => "2016-09-19 13:40:13 UTC"
puts user.updated_at.to_s # => "2016-09-19 13:40:16 UTC"
```
+## Configuration
+
+### Logging
+
+In order to log database operations, you can configure a logger:
+
+```ruby
+Hanami::Model.configure do
+ # ...
+ logger "log/development.log", level: :debug
+end
+```
+
+It accepts the following arguments:
+
+ * `stream`: a Ruby StringIO object - it can be `$stdout` or a path to file (eg. `"log/development.log"`) - Defaults to `$stdout`
+ * `:level`: logging level - it can be: `:debug`, `:info`, `:warn`, `:error`, `:fatal`, `:unknown` - Defaults to `:debug`
+ * `:formatter`: logging formatter - it can be: `:default` or `:json` - Defaults to `:default`
+
## Versioning
__Hanami::Model__ uses [Semantic Versioning 2.0.0](http://semver.org)
## Contributing
@@ -270,8 +289,8 @@
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
## Copyright
-Copyright © 2014-2016 Luca Guidi – Released under MIT License
+Copyright © 2014-2017 Luca Guidi – Released under MIT License
This project was formerly known as Lotus (`lotus-model`).