mongo_mysql_relations 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -18,7 +18,45 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ Add MongoMySqlRelations to your models (both Active record and mongoid)
22
+
23
+ class User < ActiveRecord::Base
24
+ include MongoMysqlRelations
25
+
26
+ end
27
+
28
+ and mongoid:
29
+
30
+ class Picture
31
+ include Mongoid::Document
32
+ include MongoMysqlRelations
33
+ end
34
+
35
+ on the mongo side you can use:
36
+ * to_mysql_belongs_to
37
+ * to_mysql_has_many
38
+ * to_mysql_has_one
39
+
40
+ and on the ActiveRecord side
41
+
42
+ * from_mysql_belongs_to
43
+ * from_mysql_has_many
44
+ * from_mysql_has_one
45
+
46
+ you'll need to specify the association class and sometimes the foreign key (in `has_*` associations)
47
+
48
+ class Picture
49
+ include Mongoid::Document
50
+ include MongoMysqlRelations
51
+
52
+ to_mysql_belongs_to :user, :class => User
53
+ end
54
+
55
+ class User < ActiveRecord::Base
56
+ include MongoMysqlRelations
57
+
58
+ from_mysql_has_many :pictures, :class => Picture, :foreign_key => "user_id"
59
+ end
22
60
 
23
61
  ## Contributing
24
62
 
@@ -1,3 +1,3 @@
1
1
  module MongoMysqlRelations
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo_mysql_relations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: