nay-record_with_operator 0.0.8 → 0.0.9

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/Rakefile CHANGED
@@ -12,7 +12,7 @@ DESCRIPTION = "Rails plugin to set created_by, updated_by, deleted_by to ActiveR
12
12
  GITHUB_PROJECT = "record_with_operator"
13
13
  HOMEPAGE = "http://github.com/nay/#{GITHUB_PROJECT}/tree"
14
14
  BIN_FILES = %w( )
15
- VER = "0.0.8"
15
+ VER = "0.0.9"
16
16
  CLEAN.include ['pkg']
17
17
 
18
18
  desc 'Default: run unit tests.'
@@ -21,4 +21,12 @@ module AssociationWithOperator
21
21
  results
22
22
  end
23
23
 
24
- end
24
+ def construct_join_attributes(associate)
25
+ join_attributes = super
26
+ if @owner.operator || associate.operator
27
+ join_attributes[:operator] ||= @owner.operator
28
+ join_attributes[:operator] ||= associate.operator
29
+ end
30
+ join_attributes
31
+ end
32
+ end
@@ -20,9 +20,9 @@ module RecordWithOperator
20
20
 
21
21
  def create_operator_associations
22
22
  return if operator_associations_created?
23
- belongs_to :creator, :foreign_key => "created_by", :class_name => RecordWithOperator.config[:user_class_name] if column_names.include?('created_by')
24
- belongs_to :updater, :foreign_key => "updated_by", :class_name => RecordWithOperator.config[:user_class_name] if column_names.include?('updated_by')
25
- belongs_to :deleter, :foreign_key => "deleted_by", :class_name => RecordWithOperator.config[:user_class_name] if column_names.include?('deleted_by')
23
+ belongs_to :creator, :foreign_key => "created_by", :class_name => RecordWithOperator.config[:user_class_name]
24
+ belongs_to :updater, :foreign_key => "updated_by", :class_name => RecordWithOperator.config[:user_class_name]
25
+ belongs_to :deleter, :foreign_key => "deleted_by", :class_name => RecordWithOperator.config[:user_class_name]
26
26
  @operator_associations_created = true
27
27
  end
28
28
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nay-record_with_operator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yasuko Ohba
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-11 00:00:00 -07:00
12
+ date: 2009-03-18 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -42,13 +42,13 @@ files:
42
42
  - lib/record_with_operator.rb
43
43
  - tasks/record_with_operator_tasks.rake
44
44
  - rails/init.rb
45
- - test/record_with_operator_belongs_to_association_test.rb
46
- - test/record_with_operator_has_one_association_test.rb
47
- - test/record_with_operator_reflection_test.rb
48
- - test/record_with_operator_test.rb
49
45
  - test/record_with_operator_user_class_name_test.rb
50
46
  - test/schema.rb
51
47
  - test/test_helper.rb
48
+ - test/record_with_operator_reflection_test.rb
49
+ - test/record_with_operator_has_one_association_test.rb
50
+ - test/record_with_operator_test.rb
51
+ - test/record_with_operator_belongs_to_association_test.rb
52
52
  - test/database.yml
53
53
  has_rdoc: true
54
54
  homepage: http://github.com/nay/record_with_operator/tree
@@ -78,11 +78,11 @@ signing_key:
78
78
  specification_version: 2
79
79
  summary: Rails plugin to set created_by, updated_by, deleted_by to ActiveRecord objects. Supports associations.
80
80
  test_files:
81
- - test/record_with_operator_belongs_to_association_test.rb
82
- - test/record_with_operator_has_one_association_test.rb
83
- - test/record_with_operator_reflection_test.rb
84
- - test/record_with_operator_test.rb
85
81
  - test/record_with_operator_user_class_name_test.rb
86
82
  - test/schema.rb
87
83
  - test/test_helper.rb
84
+ - test/record_with_operator_reflection_test.rb
85
+ - test/record_with_operator_has_one_association_test.rb
86
+ - test/record_with_operator_test.rb
87
+ - test/record_with_operator_belongs_to_association_test.rb
88
88
  - test/database.yml