README.md in embedson-1.0.4 vs README.md in embedson-1.1.0
- old
+ new
@@ -4,20 +4,20 @@
[![Test Coverage](https://codeclimate.com/github/sufleR/embedson/badges/coverage.svg)](https://codeclimate.com/github/sufleR/embedson)
[![Build Status](https://travis-ci.org/sufleR/embedson.svg?branch=master)](https://travis-ci.org/sufleR/embedson)
# Embedson
-Adds functionality of `embeds_one` to ActiveRecord.
+Main goal is to implement Mongoids embedded document functionality in ActiveRecord.
-Adds functionality of `embedded_in` to any class:
+Hash representation of class defined by specified method (default `to_h`) is saved in json/hstore column.
-- with defined `to_h` method which should return `Hash`
-- initialized with Hash.
+Adds functionality of `embeds_one` to ActiveRecord.
-Result of `to_h` is saved json/hstore column.
+Adds functionality of `embedded_in` to any class initialized with Hash.
+
## Installation
Add this line to your application's Gemfile:
gem 'embedson'
@@ -48,10 +48,13 @@
end
end
class Test < ActiveRecord::Base
- embeds_one :virt, class_name: Virt, column_name: :data, inverse_of: :parent
+ embeds_one :virt, class_name: Virt,
+ column_name: :data,
+ inverse_of: :parent,
+ hash_method: :to_h # default option
end
class Virt
include Virtus.model
extend Embedson::Model