nay-record_with_operator 0.0.9 → 0.0.10
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 +1 -1
- data/lib/record_with_operator.rb +6 -3
- metadata +1 -1
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.
|
15
|
+
VER = "0.0.10"
|
16
16
|
CLEAN.include ['pkg']
|
17
17
|
|
18
18
|
desc 'Default: run unit tests.'
|
data/lib/record_with_operator.rb
CHANGED
@@ -20,10 +20,13 @@ 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]
|
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
23
|
@operator_associations_created = true
|
24
|
+
|
25
|
+
if self.table_exists?
|
26
|
+
belongs_to :creator, :foreign_key => "created_by", :class_name => RecordWithOperator.config[:user_class_name] if column_names.include?('created_by')
|
27
|
+
belongs_to :updater, :foreign_key => "updated_by", :class_name => RecordWithOperator.config[:user_class_name] if column_names.include?('updated_by')
|
28
|
+
belongs_to :deleter, :foreign_key => "deleted_by", :class_name => RecordWithOperator.config[:user_class_name] if column_names.include?('deleted_by')
|
29
|
+
end
|
27
30
|
end
|
28
31
|
|
29
32
|
def has_many_with_operator(*args, &extension)
|