tophold_engine 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,8 +6,18 @@ class SubTopic
6
6
 
7
7
  field :content, type: String
8
8
 
9
- belongs_to :creator, class_name: "User", foreign_key: :creator_id
9
+ field :creator_id, type: Integer
10
10
 
11
11
  belongs_to :topic
12
12
 
13
+ def creator
14
+ return nil if self.creator_id.blank?
15
+ User.find self.creator_id
16
+ end
17
+
18
+ def creator= u
19
+ return unless u.is_a?(User)
20
+ self.creator_id = u.id
21
+ end
22
+
13
23
  end
data/app/models/tag.rb CHANGED
@@ -7,10 +7,10 @@ class Tag
7
7
 
8
8
  recursively_embeds_many
9
9
 
10
- embedded_in :article, ploymorphic: true
10
+ embedded_in :article, polymorphic: true
11
11
 
12
- embedded_in :topic, ploymorphic: true
12
+ embedded_in :topic, polymorphic: true
13
13
 
14
- embedded_in :sub_topic, ploymorphic: true
14
+ embedded_in :sub_topic, polymorphic: true
15
15
 
16
16
  end
data/app/models/user.rb CHANGED
@@ -3,6 +3,4 @@ class User < ActiveRecord::Base
3
3
 
4
4
  has_one :user_document, :class_name => "UserDocument"
5
5
 
6
- has_many :sub_topics, foreign_key: :creator_id
7
-
8
6
  end
@@ -1,3 +1,3 @@
1
1
  module TopholdEngine
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tophold_engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: