record_with_operator 0.0.22 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.rdoc +6 -1
- data/Rakefile +0 -44
- data/init.rb +1 -1
- data/lib/record_with_operator/associations/extension.rb +24 -0
- data/lib/record_with_operator/extension.rb +146 -0
- data/lib/record_with_operator/relation_methods.rb +66 -0
- data/lib/record_with_operator/utility.rb +19 -0
- data/lib/record_with_operator/version.rb +2 -2
- data/lib/record_with_operator.rb +5 -166
- data/record_with_operator.gemspec +11 -3
- data/test/database.yml +16 -16
- data/test/record_with_operator_has_many_dependent_test.rb +8 -4
- data/test/record_with_operator_test.rb +10 -16
- data/test/test_helper.rb +5 -5
- metadata +100 -24
- data/.idea/inspectionProfiles/Project_Default.xml +0 -11
- data/.idea/inspectionProfiles/profiles_settings.xml +0 -7
- data/.idea/workspace.xml +0 -455
- data/lib/association_with_operator.rb +0 -34
- data/record_with_operator/.gitignore +0 -4
- data/record_with_operator/Gemfile +0 -4
- data/record_with_operator/Rakefile +0 -2
- data/record_with_operator/lib/record_with_operator/version.rb +0 -3
- data/record_with_operator/lib/record_with_operator.rb +0 -3
- data/record_with_operator/record_with_operator.gemspec +0 -21
@@ -1,34 +0,0 @@
|
|
1
|
-
module AssociationWithOperator
|
2
|
-
|
3
|
-
def find(*args)
|
4
|
-
results = super
|
5
|
-
if results.kind_of? Array
|
6
|
-
results.each{|r| r.operator = proxy_owner.operator}
|
7
|
-
else
|
8
|
-
results.operator = proxy_owner.operator if results
|
9
|
-
end
|
10
|
-
results
|
11
|
-
end
|
12
|
-
|
13
|
-
|
14
|
-
def method_missing(method, *args)
|
15
|
-
results = super
|
16
|
-
unless ActiveRecord::NamedScope::Scope === results
|
17
|
-
if results.respond_to?(:operator=)
|
18
|
-
results.operator= proxy_owner.operator
|
19
|
-
elsif results.kind_of? Array
|
20
|
-
results.each{|r| r.operator = proxy_owner.operator if r.respond_to?(:operator=)}
|
21
|
-
end
|
22
|
-
end
|
23
|
-
results
|
24
|
-
end
|
25
|
-
|
26
|
-
def construct_join_attributes(associate)
|
27
|
-
join_attributes = super
|
28
|
-
if @owner.operator || associate.operator
|
29
|
-
join_attributes[:operator] ||= @owner.operator
|
30
|
-
join_attributes[:operator] ||= associate.operator
|
31
|
-
end
|
32
|
-
join_attributes
|
33
|
-
end
|
34
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "record_with_operator/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |s|
|
6
|
-
s.name = "record_with_operator"
|
7
|
-
s.version = RecordWithOperator::VERSION
|
8
|
-
s.platform = Gem::Platform::RUBY
|
9
|
-
s.authors = ["TODO: Write your name"]
|
10
|
-
s.email = ["TODO: Write your email address"]
|
11
|
-
s.homepage = ""
|
12
|
-
s.summary = %q{TODO: Write a gem summary}
|
13
|
-
s.description = %q{TODO: Write a gem description}
|
14
|
-
|
15
|
-
s.rubyforge_project = "record_with_operator"
|
16
|
-
|
17
|
-
s.files = `git ls-files`.split("\n")
|
18
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
-
s.require_paths = ["lib"]
|
21
|
-
end
|