deferred_associations 0.5.5 → 0.5.6
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.
- checksums.yaml +15 -0
- data/CHANGELOG +5 -0
- data/Rakefile +27 -27
- data/Readme.markdown +84 -84
- data/deferred_associations.gemspec +61 -61
- data/init.rb +1 -1
- data/lib/has_and_belongs_to_many_with_deferred_save.rb +142 -142
- data/lib/has_many_with_deferred_save.rb +3 -3
- data/spec/db/database.yml +21 -21
- data/spec/db/schema.rb +40 -40
- data/spec/has_and_belongs_to_many_with_deferred_save_spec.rb +244 -236
- data/spec/models/door.rb +3 -3
- data/spec/models/person.rb +15 -15
- data/spec/models/room.rb +51 -51
- data/spec/spec_helper.rb +46 -46
- metadata +3 -9
data/spec/spec_helper.rb
CHANGED
@@ -1,47 +1,47 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
|
2
|
-
plugin_test_dir = File.dirname(__FILE__)
|
3
|
-
|
4
|
-
|
5
|
-
require 'active_record'
|
6
|
-
if ActiveRecord::VERSION::STRING >= "3"
|
7
|
-
require 'logger'
|
8
|
-
else
|
9
|
-
# Workaround for https://rails.lighthouseapp.com/projects/8994/tickets/2577-when-using-activerecordassociations-outside-of-rails-a-nameerror-is-thrown
|
10
|
-
ActiveRecord::ActiveRecordError
|
11
|
-
end
|
12
|
-
|
13
|
-
require plugin_test_dir + '/../init.rb'
|
14
|
-
|
15
|
-
ActiveRecord::Base.logger = Logger.new(plugin_test_dir + "/test.log")
|
16
|
-
|
17
|
-
ActiveRecord::Base.configurations = YAML::load(IO.read(plugin_test_dir + "/db/database.yml"))
|
18
|
-
ActiveRecord::Base.establish_connection(
|
19
|
-
ActiveRecord::Migration.verbose = false
|
20
|
-
load(File.join(plugin_test_dir, "db", "schema.rb"))
|
21
|
-
|
22
|
-
Dir["#{plugin_test_dir}/models/*.rb"].each {|file| require file }
|
23
|
-
|
24
|
-
RSpec.configure do |config|
|
25
|
-
config.before do
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
class ActiveRecord::Base
|
30
|
-
|
31
|
-
# Compatibility method for AR 2.3.x and AR 3.2.x
|
32
|
-
def get_error attr
|
33
|
-
if errors.respond_to?(:on)
|
34
|
-
errors.on(attr)
|
35
|
-
else
|
36
|
-
errors[attr].try(:first)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def ar2?
|
42
|
-
ActiveRecord::VERSION::STRING < "3"
|
43
|
-
end
|
44
|
-
|
45
|
-
def ar4?
|
46
|
-
ActiveRecord::VERSION::STRING >= "4"
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
|
2
|
+
plugin_test_dir = File.dirname(__FILE__)
|
3
|
+
|
4
|
+
|
5
|
+
require 'active_record'
|
6
|
+
if ActiveRecord::VERSION::STRING >= "3"
|
7
|
+
require 'logger'
|
8
|
+
else
|
9
|
+
# Workaround for https://rails.lighthouseapp.com/projects/8994/tickets/2577-when-using-activerecordassociations-outside-of-rails-a-nameerror-is-thrown
|
10
|
+
ActiveRecord::ActiveRecordError
|
11
|
+
end
|
12
|
+
|
13
|
+
require plugin_test_dir + '/../init.rb'
|
14
|
+
|
15
|
+
ActiveRecord::Base.logger = Logger.new(plugin_test_dir + "/test.log")
|
16
|
+
|
17
|
+
ActiveRecord::Base.configurations = YAML::load(IO.read(plugin_test_dir + "/db/database.yml"))
|
18
|
+
ActiveRecord::Base.establish_connection(:sqlite3mem)
|
19
|
+
ActiveRecord::Migration.verbose = false
|
20
|
+
load(File.join(plugin_test_dir, "db", "schema.rb"))
|
21
|
+
|
22
|
+
Dir["#{plugin_test_dir}/models/*.rb"].each {|file| require file }
|
23
|
+
|
24
|
+
RSpec.configure do |config|
|
25
|
+
config.before do
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class ActiveRecord::Base
|
30
|
+
|
31
|
+
# Compatibility method for AR 2.3.x and AR 3.2.x
|
32
|
+
def get_error attr
|
33
|
+
if errors.respond_to?(:on)
|
34
|
+
errors.on(attr)
|
35
|
+
else
|
36
|
+
errors[attr].try(:first)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def ar2?
|
42
|
+
ActiveRecord::VERSION::STRING < "3"
|
43
|
+
end
|
44
|
+
|
45
|
+
def ar4?
|
46
|
+
ActiveRecord::VERSION::STRING >= "4"
|
47
47
|
end
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deferred_associations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
5
|
-
prerelease:
|
4
|
+
version: 0.5.6
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Martin Koerner
|
@@ -16,7 +15,6 @@ dependencies:
|
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: activerecord
|
18
17
|
requirement: !ruby/object:Gem::Requirement
|
19
|
-
none: false
|
20
18
|
requirements:
|
21
19
|
- - ! '>='
|
22
20
|
- !ruby/object:Gem::Version
|
@@ -24,7 +22,6 @@ dependencies:
|
|
24
22
|
type: :runtime
|
25
23
|
prerelease: false
|
26
24
|
version_requirements: !ruby/object:Gem::Requirement
|
27
|
-
none: false
|
28
25
|
requirements:
|
29
26
|
- - ! '>='
|
30
27
|
- !ruby/object:Gem::Version
|
@@ -32,7 +29,6 @@ dependencies:
|
|
32
29
|
- !ruby/object:Gem::Dependency
|
33
30
|
name: rspec
|
34
31
|
requirement: !ruby/object:Gem::Requirement
|
35
|
-
none: false
|
36
32
|
requirements:
|
37
33
|
- - ! '>='
|
38
34
|
- !ruby/object:Gem::Version
|
@@ -40,7 +36,6 @@ dependencies:
|
|
40
36
|
type: :development
|
41
37
|
prerelease: false
|
42
38
|
version_requirements: !ruby/object:Gem::Requirement
|
43
|
-
none: false
|
44
39
|
requirements:
|
45
40
|
- - ! '>='
|
46
41
|
- !ruby/object:Gem::Version
|
@@ -79,25 +74,24 @@ files:
|
|
79
74
|
- spec/spec_helper.rb
|
80
75
|
homepage: http://github.com/MartinKoerner/deferred_associations
|
81
76
|
licenses: []
|
77
|
+
metadata: {}
|
82
78
|
post_install_message:
|
83
79
|
rdoc_options: []
|
84
80
|
require_paths:
|
85
81
|
- lib
|
86
82
|
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
-
none: false
|
88
83
|
requirements:
|
89
84
|
- - ! '>='
|
90
85
|
- !ruby/object:Gem::Version
|
91
86
|
version: '0'
|
92
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
-
none: false
|
94
88
|
requirements:
|
95
89
|
- - ! '>='
|
96
90
|
- !ruby/object:Gem::Version
|
97
91
|
version: '0'
|
98
92
|
requirements: []
|
99
93
|
rubyforge_project:
|
100
|
-
rubygems_version:
|
94
|
+
rubygems_version: 2.2.2
|
101
95
|
signing_key:
|
102
96
|
specification_version: 3
|
103
97
|
summary: Makes ActiveRecord defer/postpone habtm or has_many associations
|