mongomodel 0.4.8 → 0.4.9
Sign up to get free protection for your applications and to get access to all the features.
- data/Appraisals +34 -14
- data/Gemfile +1 -1
- data/bin/console +6 -5
- data/gemfiles/mongo_mapper.gemfile +3 -3
- data/gemfiles/mongoid.gemfile +3 -3
- data/gemfiles/rails-3.1.gemfile +3 -3
- data/gemfiles/rails-3.2.gemfile +3 -3
- data/gemfiles/rails-4-observers.gemfile +13 -0
- data/gemfiles/rails-4-protected-attributes.gemfile +13 -0
- data/gemfiles/rails-4.gemfile +2 -1
- data/lib/mongomodel.rb +13 -1
- data/lib/mongomodel/concerns/attribute_methods/protected.rb +17 -13
- data/lib/mongomodel/concerns/observing.rb +35 -35
- data/lib/mongomodel/document/persistence.rb +1 -1
- data/lib/mongomodel/embedded_document.rb +1 -1
- data/lib/mongomodel/support/types/date_time.rb +1 -1
- data/lib/mongomodel/version.rb +1 -1
- data/mongomodel.gemspec +1 -1
- data/spec/mongomodel/concerns/attribute_methods/protected_spec.rb +62 -60
- data/spec/mongomodel/concerns/observing_spec.rb +33 -31
- data/spec/spec_helper.rb +1 -1
- metadata +7 -5
data/Appraisals
CHANGED
@@ -1,26 +1,46 @@
|
|
1
|
+
RAILS_3_1 = "3.1.10"
|
2
|
+
RAILS_3_2 = "3.2.11"
|
3
|
+
|
1
4
|
appraise "rails-3.1" do
|
2
|
-
gem "activesupport",
|
3
|
-
gem "activemodel",
|
5
|
+
gem "activesupport", RAILS_3_1
|
6
|
+
gem "activemodel", RAILS_3_1
|
4
7
|
end
|
5
8
|
|
6
9
|
appraise "rails-3.2" do
|
7
|
-
gem "activesupport",
|
8
|
-
gem "activemodel",
|
10
|
+
gem "activesupport", RAILS_3_2
|
11
|
+
gem "activemodel", RAILS_3_2
|
9
12
|
end
|
10
13
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
14
|
+
if RUBY_VERSION >= "1.9"
|
15
|
+
appraise "rails-4" do
|
16
|
+
gem "activesupport", :git => "https://github.com/rails/rails.git"
|
17
|
+
gem "activemodel", :git => "https://github.com/rails/rails.git"
|
18
|
+
gem "journey", :git => "https://github.com/rails/journey.git"
|
19
|
+
end
|
20
|
+
|
21
|
+
appraise "rails-4-protected-attributes" do
|
22
|
+
gem "activesupport", :git => "https://github.com/rails/rails.git"
|
23
|
+
gem "activemodel", :git => "https://github.com/rails/rails.git"
|
24
|
+
gem "protected_attributes", :git=>"https://github.com/rails/protected_attributes.git"
|
25
|
+
gem "journey", :git => "https://github.com/rails/journey.git"
|
26
|
+
end
|
27
|
+
|
28
|
+
appraise "rails-4-observers" do
|
29
|
+
gem "activesupport", :git => "https://github.com/rails/rails.git"
|
30
|
+
gem "activemodel", :git => "https://github.com/rails/rails.git"
|
31
|
+
gem "rails-observers", :git => "https://github.com/rails/rails-observers.git"
|
32
|
+
gem "journey", :git => "https://github.com/rails/journey.git"
|
33
|
+
end
|
15
34
|
|
16
|
-
appraise "mongoid" do
|
17
|
-
|
18
|
-
|
19
|
-
|
35
|
+
appraise "mongoid" do
|
36
|
+
gem "mongoid"
|
37
|
+
gem "activesupport", RAILS_3_2
|
38
|
+
gem "activemodel", RAILS_3_2
|
39
|
+
end
|
20
40
|
end
|
21
41
|
|
22
42
|
appraise "mongo_mapper" do
|
23
43
|
gem "mongo_mapper"
|
24
|
-
gem "activesupport",
|
25
|
-
gem "activemodel",
|
44
|
+
gem "activesupport", RAILS_3_2
|
45
|
+
gem "activemodel", RAILS_3_2
|
26
46
|
end
|
data/Gemfile
CHANGED
data/bin/console
CHANGED
@@ -3,15 +3,16 @@
|
|
3
3
|
puts "Loading MongoModel sandbox..."
|
4
4
|
|
5
5
|
require "rubygems"
|
6
|
-
require "bundler
|
7
|
-
Bundler.
|
8
|
-
|
9
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
|
6
|
+
require "bundler"
|
7
|
+
Bundler.setup
|
10
8
|
|
11
9
|
require 'irb'
|
12
10
|
require 'irb/completion'
|
13
11
|
|
14
|
-
|
12
|
+
require "mongomodel"
|
13
|
+
|
14
|
+
logger = defined?(ActiveSupport::Logger) ? ActiveSupport::Logger : ActiveSupport::BufferedLogger
|
15
|
+
MongoModel.logger = logger.new(STDERR)
|
15
16
|
|
16
17
|
IRB.setup(nil)
|
17
18
|
|
@@ -3,10 +3,10 @@
|
|
3
3
|
source "http://rubygems.org"
|
4
4
|
|
5
5
|
gem "appraisal", "~> 0.3.6"
|
6
|
-
gem "bson_ext", "~> 1.
|
6
|
+
gem "bson_ext", "~> 1.8"
|
7
7
|
gem "tzinfo"
|
8
8
|
gem "mongo_mapper"
|
9
|
-
gem "activesupport", "3.2.
|
10
|
-
gem "activemodel", "3.2.
|
9
|
+
gem "activesupport", "3.2.11"
|
10
|
+
gem "activemodel", "3.2.11"
|
11
11
|
|
12
12
|
gemspec :path=>"../"
|
data/gemfiles/mongoid.gemfile
CHANGED
@@ -3,10 +3,10 @@
|
|
3
3
|
source "http://rubygems.org"
|
4
4
|
|
5
5
|
gem "appraisal", "~> 0.3.6"
|
6
|
-
gem "bson_ext", "~> 1.
|
6
|
+
gem "bson_ext", "~> 1.8"
|
7
7
|
gem "tzinfo"
|
8
8
|
gem "mongoid"
|
9
|
-
gem "activesupport", "3.2.
|
10
|
-
gem "activemodel", "3.2.
|
9
|
+
gem "activesupport", "3.2.11"
|
10
|
+
gem "activemodel", "3.2.11"
|
11
11
|
|
12
12
|
gemspec :path=>"../"
|
data/gemfiles/rails-3.1.gemfile
CHANGED
@@ -3,9 +3,9 @@
|
|
3
3
|
source "http://rubygems.org"
|
4
4
|
|
5
5
|
gem "appraisal", "~> 0.3.6"
|
6
|
-
gem "bson_ext", "~> 1.
|
6
|
+
gem "bson_ext", "~> 1.8"
|
7
7
|
gem "tzinfo"
|
8
|
-
gem "activesupport", "3.1.
|
9
|
-
gem "activemodel", "3.1.
|
8
|
+
gem "activesupport", "3.1.10"
|
9
|
+
gem "activemodel", "3.1.10"
|
10
10
|
|
11
11
|
gemspec :path=>"../"
|
data/gemfiles/rails-3.2.gemfile
CHANGED
@@ -3,9 +3,9 @@
|
|
3
3
|
source "http://rubygems.org"
|
4
4
|
|
5
5
|
gem "appraisal", "~> 0.3.6"
|
6
|
-
gem "bson_ext", "~> 1.
|
6
|
+
gem "bson_ext", "~> 1.8"
|
7
7
|
gem "tzinfo"
|
8
|
-
gem "activesupport", "3.2.
|
9
|
-
gem "activemodel", "3.2.
|
8
|
+
gem "activesupport", "3.2.11"
|
9
|
+
gem "activemodel", "3.2.11"
|
10
10
|
|
11
11
|
gemspec :path=>"../"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "http://rubygems.org"
|
4
|
+
|
5
|
+
gem "appraisal", "~> 0.3.6"
|
6
|
+
gem "bson_ext", "~> 1.8"
|
7
|
+
gem "tzinfo"
|
8
|
+
gem "activesupport", :git=>"https://github.com/rails/rails.git"
|
9
|
+
gem "activemodel", :git=>"https://github.com/rails/rails.git"
|
10
|
+
gem "rails-observers", :git=>"https://github.com/rails/rails-observers.git"
|
11
|
+
gem "journey", :git=>"https://github.com/rails/journey.git"
|
12
|
+
|
13
|
+
gemspec :path=>"../"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "http://rubygems.org"
|
4
|
+
|
5
|
+
gem "appraisal", "~> 0.3.6"
|
6
|
+
gem "bson_ext", "~> 1.8"
|
7
|
+
gem "tzinfo"
|
8
|
+
gem "activesupport", :git=>"https://github.com/rails/rails.git"
|
9
|
+
gem "activemodel", :git=>"https://github.com/rails/rails.git"
|
10
|
+
gem "protected_attributes", :git=>"https://github.com/rails/protected_attributes.git"
|
11
|
+
gem "journey", :git=>"https://github.com/rails/journey.git"
|
12
|
+
|
13
|
+
gemspec :path=>"../"
|
data/gemfiles/rails-4.gemfile
CHANGED
@@ -3,9 +3,10 @@
|
|
3
3
|
source "http://rubygems.org"
|
4
4
|
|
5
5
|
gem "appraisal", "~> 0.3.6"
|
6
|
-
gem "bson_ext", "~> 1.
|
6
|
+
gem "bson_ext", "~> 1.8"
|
7
7
|
gem "tzinfo"
|
8
8
|
gem "activesupport", :git=>"https://github.com/rails/rails.git"
|
9
9
|
gem "activemodel", :git=>"https://github.com/rails/rails.git"
|
10
|
+
gem "journey", :git=>"https://github.com/rails/journey.git"
|
10
11
|
|
11
12
|
gemspec :path=>"../"
|
data/lib/mongomodel.rb
CHANGED
@@ -9,6 +9,18 @@ require 'mongomodel/log_subscriber'
|
|
9
9
|
|
10
10
|
require 'active_support/core_ext/module/attribute_accessors'
|
11
11
|
|
12
|
+
begin
|
13
|
+
require "rails/observers/active_model/active_model"
|
14
|
+
rescue LoadError
|
15
|
+
# Either ActiveModel < 4 or rails-observers gem is not available
|
16
|
+
end
|
17
|
+
|
18
|
+
begin
|
19
|
+
require "protected_attributes"
|
20
|
+
rescue LoadError
|
21
|
+
# Either ActiveModel < 4 or protected_attributes gem is not available
|
22
|
+
end
|
23
|
+
|
12
24
|
module MongoModel
|
13
25
|
autoload :VERSION, 'mongomodel/version'
|
14
26
|
|
@@ -103,7 +115,7 @@ module MongoModel
|
|
103
115
|
@_database ||= configuration.establish_connection
|
104
116
|
end
|
105
117
|
|
106
|
-
require 'mongomodel/railtie' if defined?(Rails)
|
118
|
+
require 'mongomodel/railtie' if defined?(Rails::Railtie)
|
107
119
|
|
108
120
|
require 'mongomodel/compatibility/mongoid' if defined?(Mongoid)
|
109
121
|
require 'mongomodel/compatibility/mongo_mapper' if defined?(MongoMapper)
|
@@ -3,25 +3,29 @@ module MongoModel
|
|
3
3
|
module Protected
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
|
-
|
6
|
+
if defined?(ActiveModel::MassAssignmentSecurity)
|
7
|
+
include ActiveModel::MassAssignmentSecurity
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
module ClassMethods
|
10
|
+
def property(name, *args, &block)#:nodoc:
|
11
|
+
property = super(name, *args, &block)
|
11
12
|
|
12
|
-
|
13
|
-
|
13
|
+
attr_protected(name) if property.options[:protected]
|
14
|
+
attr_accessible(name) if property.options[:accessible]
|
14
15
|
|
15
|
-
|
16
|
+
property
|
17
|
+
end
|
16
18
|
end
|
17
|
-
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
def assign_attributes(attrs, options={})
|
21
|
+
if options[:without_protection]
|
22
|
+
super
|
23
|
+
else
|
24
|
+
super(sanitize_for_mass_assignment(attrs, options[:as] || :default))
|
25
|
+
end
|
24
26
|
end
|
27
|
+
elsif defined?(ActiveModel::DeprecatedMassAssignmentSecurity)
|
28
|
+
include ActiveModel::DeprecatedMassAssignmentSecurity
|
25
29
|
end
|
26
30
|
end
|
27
31
|
end
|
@@ -1,35 +1,35 @@
|
|
1
|
-
module MongoModel
|
2
|
-
module Observing
|
3
|
-
extend ActiveSupport::Concern
|
4
|
-
include ActiveModel::Observing
|
5
|
-
end
|
6
|
-
|
7
|
-
class Observer < ActiveModel::Observer
|
8
|
-
protected
|
9
|
-
def observed_classes
|
10
|
-
klasses = super
|
11
|
-
klasses + klasses.map { |klass| klass.descendants }.flatten
|
12
|
-
end
|
13
|
-
|
14
|
-
def add_observer!(klass)
|
15
|
-
super
|
16
|
-
define_callbacks(klass)
|
17
|
-
end
|
18
|
-
|
19
|
-
def define_callbacks(klass)
|
20
|
-
observer = self
|
21
|
-
observer_name = observer.class.name.underscore.gsub('/', '__')
|
22
|
-
|
23
|
-
MongoModel::Callbacks::CALLBACKS.each do |callback|
|
24
|
-
next unless respond_to?(callback)
|
25
|
-
callback_meth = :"_notify_#{observer_name}_for_#{callback}"
|
26
|
-
unless klass.respond_to?(callback_meth)
|
27
|
-
klass.send(:define_method, callback_meth) do |&block|
|
28
|
-
observer.update(callback, self, &block)
|
29
|
-
end
|
30
|
-
klass.send(callback, callback_meth)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
1
|
+
module MongoModel
|
2
|
+
module Observing
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
include ActiveModel::Observing
|
5
|
+
end
|
6
|
+
|
7
|
+
class Observer < ActiveModel::Observer
|
8
|
+
protected
|
9
|
+
def observed_classes
|
10
|
+
klasses = super
|
11
|
+
klasses + klasses.map { |klass| klass.descendants }.flatten
|
12
|
+
end
|
13
|
+
|
14
|
+
def add_observer!(klass)
|
15
|
+
super
|
16
|
+
define_callbacks(klass)
|
17
|
+
end
|
18
|
+
|
19
|
+
def define_callbacks(klass)
|
20
|
+
observer = self
|
21
|
+
observer_name = observer.class.name.underscore.gsub('/', '__')
|
22
|
+
|
23
|
+
MongoModel::Callbacks::CALLBACKS.each do |callback|
|
24
|
+
next unless respond_to?(callback)
|
25
|
+
callback_meth = :"_notify_#{observer_name}_for_#{callback}"
|
26
|
+
unless klass.respond_to?(callback_meth)
|
27
|
+
klass.send(:define_method, callback_meth) do |&block|
|
28
|
+
observer.update(callback, self, &block)
|
29
|
+
end
|
30
|
+
klass.send(callback, callback_meth)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -153,7 +153,7 @@ module MongoModel
|
|
153
153
|
end
|
154
154
|
|
155
155
|
def save_to_collection
|
156
|
-
collection.save(to_mongo, :
|
156
|
+
collection.save(to_mongo, :w => self.class.save_safely? ? 1 : 0)
|
157
157
|
set_new_record(false)
|
158
158
|
true
|
159
159
|
rescue Mongo::OperationFailure => e
|
@@ -32,7 +32,7 @@ module MongoModel
|
|
32
32
|
# Define our own to_time method as DateTime.to_time in ActiveSupport may return
|
33
33
|
# the DateTime object unchanged, whereas BSON expects an actual Time object.
|
34
34
|
def to_time(dt)
|
35
|
-
::Time.
|
35
|
+
::Time.utc(dt.year, dt.month, dt.day, dt.hour, dt.min, dt.sec)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
data/lib/mongomodel/version.rb
CHANGED
data/mongomodel.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
|
17
17
|
s.add_dependency "activesupport", ">= 3.1"
|
18
18
|
s.add_dependency "activemodel", ">= 3.1"
|
19
|
-
s.add_dependency "mongo", "~> 1.
|
19
|
+
s.add_dependency "mongo", "~> 1.8"
|
20
20
|
|
21
21
|
s.add_development_dependency "bundler", ">= 1.0.0"
|
22
22
|
s.add_development_dependency "rspec", "~> 2.8"
|
@@ -1,84 +1,86 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
module MongoModel
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
if ActiveModel::VERSION::STRING < '4.0' || Gem.loaded_specs['protected_attributes']
|
5
|
+
specs_for(Document, EmbeddedDocument) do
|
6
|
+
define_class(:TestDocument, described_class) do
|
7
|
+
property :foo, String
|
8
|
+
property :bar, String
|
9
|
+
end
|
9
10
|
|
10
|
-
|
11
|
+
subject { TestDocument.new }
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
describe "#attr_protected" do
|
14
|
+
before(:each) do
|
15
|
+
TestDocument.attr_protected :foo
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
it "disallows the attribute to be mass-assigned via attributes=" do
|
19
|
+
subject.attributes = { :foo => 'value of foo' }
|
20
|
+
subject.foo.should be_nil
|
21
|
+
end
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
it "does not disallow the attribute to be assigned individually" do
|
24
|
+
subject.foo = 'value of foo'
|
25
|
+
subject.foo.should == 'value of foo'
|
26
|
+
end
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
it "does not disallow other attributes to be mass-assigned via attributes=" do
|
29
|
+
subject.attributes = { :bar => 'value of bar' }
|
30
|
+
subject.bar.should == 'value of bar'
|
31
|
+
end
|
31
32
|
|
32
|
-
|
33
|
-
|
33
|
+
it "accepts multiple attributes" do
|
34
|
+
TestDocument.attr_protected :foo, :bar
|
34
35
|
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
subject.attributes = { :foo => 'value of foo', :bar => 'value of bar' }
|
37
|
+
subject.foo.should be_nil
|
38
|
+
subject.bar.should be_nil
|
39
|
+
end
|
38
40
|
end
|
39
|
-
end
|
40
41
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
describe "#attr_accessible" do
|
43
|
+
before(:each) do
|
44
|
+
TestDocument.attr_accessible :foo
|
45
|
+
end
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
47
|
+
it "allows the attribute to be mass-assigned via attributes=" do
|
48
|
+
subject.attributes = { :foo => 'value of foo' }
|
49
|
+
subject.foo.should == 'value of foo'
|
50
|
+
end
|
50
51
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
52
|
+
it "does not disallow other attributes to be mass-assigned via attributes=" do
|
53
|
+
subject.attributes = { :bar => 'value of bar' }
|
54
|
+
subject.bar.should be_nil
|
55
|
+
end
|
55
56
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
57
|
+
it "does not disallow others attributes to be assigned individually" do
|
58
|
+
subject.bar = 'value of bar'
|
59
|
+
subject.bar.should == 'value of bar'
|
60
|
+
end
|
60
61
|
|
61
|
-
|
62
|
-
|
62
|
+
it "accepts multiple attributes" do
|
63
|
+
TestDocument.attr_accessible :foo, :bar
|
63
64
|
|
64
|
-
|
65
|
-
|
66
|
-
|
65
|
+
subject.attributes = { :foo => 'value of foo', :bar => 'value of bar' }
|
66
|
+
subject.foo.should == 'value of foo'
|
67
|
+
subject.bar.should == 'value of bar'
|
68
|
+
end
|
67
69
|
end
|
68
|
-
end
|
69
70
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
71
|
+
describe "#property" do
|
72
|
+
context "with :protected option" do
|
73
|
+
it "makes the attribute protected" do
|
74
|
+
TestDocument.should_receive(:attr_protected).with(:baz)
|
75
|
+
TestDocument.property :baz, String, :protected => true
|
76
|
+
end
|
75
77
|
end
|
76
|
-
end
|
77
78
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
79
|
+
context "with :accessible option" do
|
80
|
+
it "makes the attribute accessible" do
|
81
|
+
TestDocument.should_receive(:attr_accessible).with(:baz)
|
82
|
+
TestDocument.property :baz, String, :accessible => true
|
83
|
+
end
|
82
84
|
end
|
83
85
|
end
|
84
86
|
end
|
@@ -1,32 +1,34 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module MongoModel
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module MongoModel
|
4
|
+
if ActiveModel::VERSION::STRING < '4.0' || Gem.loaded_specs['rails-observers']
|
5
|
+
specs_for(Document) do
|
6
|
+
describe "observing" do
|
7
|
+
define_class(:TestDocument, described_class)
|
8
|
+
define_class(:TestObserver, Observer) do
|
9
|
+
observe :test_document
|
10
|
+
|
11
|
+
attr_accessor :callback
|
12
|
+
|
13
|
+
def after_save(model)
|
14
|
+
@callback.call(model) unless @callback.nil?
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
subject { TestDocument.new }
|
19
|
+
|
20
|
+
it "has an #instance method to access the observer singleton" do
|
21
|
+
TestObserver.instance.should eq(TestObserver.instance)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "invokes the TestObserver singleton's after_save method after saving" do
|
25
|
+
callback = stub
|
26
|
+
callback.should_receive(:call).with(subject)
|
27
|
+
|
28
|
+
TestObserver.instance.callback = callback
|
29
|
+
subject.save
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
32
34
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongomodel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.9
|
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:
|
12
|
+
date: 2013-01-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ~>
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '1.
|
53
|
+
version: '1.8'
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -58,7 +58,7 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1.
|
61
|
+
version: '1.8'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: bundler
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -127,6 +127,8 @@ files:
|
|
127
127
|
- gemfiles/mongoid.gemfile
|
128
128
|
- gemfiles/rails-3.1.gemfile
|
129
129
|
- gemfiles/rails-3.2.gemfile
|
130
|
+
- gemfiles/rails-4-observers.gemfile
|
131
|
+
- gemfiles/rails-4-protected-attributes.gemfile
|
130
132
|
- gemfiles/rails-4.gemfile
|
131
133
|
- lib/mongomodel.rb
|
132
134
|
- lib/mongomodel/attributes/mongo.rb
|
@@ -298,7 +300,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
298
300
|
version: '0'
|
299
301
|
segments:
|
300
302
|
- 0
|
301
|
-
hash: -
|
303
|
+
hash: -157518307966196905
|
302
304
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
303
305
|
none: false
|
304
306
|
requirements:
|