enju_question 0.0.18 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,5 @@
1
1
  require "enju_question/engine"
2
+ require "enju_question/user"
2
3
 
3
4
  module EnjuQuestion
4
5
  def self.included(base)
@@ -22,3 +23,4 @@ module EnjuQuestion
22
23
  end
23
24
 
24
25
  ActionController::Base.send(:include, EnjuQuestion)
26
+ ActiveRecord::Base.send :include, EnjuQuestion::QuestionUser
@@ -0,0 +1,25 @@
1
+ module EnjuQuestion
2
+ module QuestionUser
3
+ def self.included(base)
4
+ base.extend ClassMethods
5
+ end
6
+
7
+ module ClassMethods
8
+ def enju_question_user
9
+ include InstanceMethods
10
+ has_many :questions
11
+ has_many :answers
12
+ end
13
+ end
14
+
15
+ module InstanceMethods
16
+ def reset_answer_feed_token
17
+ self.answer_feed_token = Devise.friendly_token
18
+ end
19
+
20
+ def delete_answer_feed_token
21
+ self.answer_feed_token = nil
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,3 +1,3 @@
1
1
  module EnjuQuestion
2
- VERSION = "0.0.18"
2
+ VERSION = "0.0.19"
3
3
  end
@@ -11,8 +11,8 @@ class User < ActiveRecord::Base
11
11
  has_one :role, :through => :user_has_role
12
12
  belongs_to :user_group
13
13
  belongs_to :required_role, :class_name => 'Role', :foreign_key => 'required_role_id'
14
- has_many :questions
15
- has_many :answers
14
+
15
+ enju_question_user
16
16
 
17
17
  def has_role?(role_in_question)
18
18
  return false unless role
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enju_question
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.18
4
+ version: 0.0.19
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-19 00:00:00.000000000 Z
12
+ date: 2012-06-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -376,6 +376,7 @@ files:
376
376
  - db/migrate/20100217054028_create_answer_has_items.rb
377
377
  - db/migrate/20120418124018_add_answer_feed_token_to_user.rb
378
378
  - lib/enju_question/engine.rb
379
+ - lib/enju_question/user.rb
379
380
  - lib/enju_question/version.rb
380
381
  - lib/enju_question.rb
381
382
  - lib/tasks/enju_question_tasks.rake