activerecord-tableless 1.1.0 → 1.1.1
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/README.md +1 -1
- data/activerecord-tableless.gemspec +1 -1
- data/lib/activerecord-tableless.rb +10 -10
- data/spec/lib/activerecord-tableless_spec.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -61,7 +61,7 @@ For Rails 2.3.x series you need to add this line in the top of your model file.
|
|
61
61
|
|
62
62
|
If you wish (this is not recommended), you can pretend you have a succeeding database by using
|
63
63
|
|
64
|
-
has_no_table :database => :
|
64
|
+
has_no_table :database => :pretend_success
|
65
65
|
|
66
66
|
|
67
67
|
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.files = `git ls-files`.split($\)
|
11
11
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
12
12
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
13
|
-
gem.version = "1.1.
|
13
|
+
gem.version = "1.1.1"
|
14
14
|
gem.has_rdoc = true
|
15
15
|
|
16
16
|
gem.require_paths = ["lib"]
|
@@ -43,7 +43,7 @@ module ActiveRecord
|
|
43
43
|
# A model that needs to be tableless will call this method to indicate
|
44
44
|
# it.
|
45
45
|
def has_no_table(options = {:database => :fail_fast})
|
46
|
-
raise ArgumentError.new("Invalid database option '#{options[:database]}'") unless [:fail_fast, :
|
46
|
+
raise ArgumentError.new("Invalid database option '#{options[:database]}'") unless [:fail_fast, :pretend_success].member? options[:database]
|
47
47
|
# keep our options handy
|
48
48
|
if ActiveRecord::VERSION::STRING < "3.1.0"
|
49
49
|
write_inheritable_attribute(:tableless_options,
|
@@ -99,7 +99,7 @@ module ActiveRecord
|
|
99
99
|
eval %{
|
100
100
|
def #{m}(*args)
|
101
101
|
case tableless_options[:database]
|
102
|
-
when :
|
102
|
+
when :pretend_success
|
103
103
|
self
|
104
104
|
when :fail_fast
|
105
105
|
raise NoDatabase.new("Can't ##{m} on Tableless class")
|
@@ -111,7 +111,7 @@ module ActiveRecord
|
|
111
111
|
if ActiveRecord::VERSION::STRING < "3.0"
|
112
112
|
def find_with_ids(*args)
|
113
113
|
case tableless_options[:database]
|
114
|
-
when :
|
114
|
+
when :pretend_success
|
115
115
|
raise ActiveRecord::RecordNotFound.new("Couldn't find #{self} with ID=#{args[0].to_s}")
|
116
116
|
|
117
117
|
when :fail_fast
|
@@ -121,7 +121,7 @@ module ActiveRecord
|
|
121
121
|
|
122
122
|
def find_every(*args)
|
123
123
|
case tableless_options[:database]
|
124
|
-
when :
|
124
|
+
when :pretend_success
|
125
125
|
[]
|
126
126
|
when :fail_fast
|
127
127
|
raise NoDatabase.new("Can't #find_every on Tableless class")
|
@@ -130,7 +130,7 @@ module ActiveRecord
|
|
130
130
|
else ## ActiveRecord::VERSION::STRING >= "3.0"
|
131
131
|
def all(*args)
|
132
132
|
case tableless_options[:database]
|
133
|
-
when :
|
133
|
+
when :pretend_success
|
134
134
|
[]
|
135
135
|
when :fail_fast
|
136
136
|
raise NoDatabase.new("Can't #find_every on Tableless class")
|
@@ -141,7 +141,7 @@ module ActiveRecord
|
|
141
141
|
|
142
142
|
def transaction(&block)
|
143
143
|
case tableless_options[:database]
|
144
|
-
when :
|
144
|
+
when :pretend_success
|
145
145
|
yield
|
146
146
|
when :fail_fast
|
147
147
|
raise NoDatabase.new("Can't #transaction on Tableless class")
|
@@ -181,7 +181,7 @@ module ActiveRecord
|
|
181
181
|
|
182
182
|
def create(*args)
|
183
183
|
case self.class.tableless_options[:database]
|
184
|
-
when :
|
184
|
+
when :pretend_success
|
185
185
|
true
|
186
186
|
when :fail_fast
|
187
187
|
raise NoDatabase.new("Can't #create a Tableless object")
|
@@ -190,7 +190,7 @@ module ActiveRecord
|
|
190
190
|
|
191
191
|
def update(*args)
|
192
192
|
case self.class.tableless_options[:database]
|
193
|
-
when :
|
193
|
+
when :pretend_success
|
194
194
|
true
|
195
195
|
when :fail_fast
|
196
196
|
raise NoDatabase.new("Can't #update a Tableless object")
|
@@ -199,7 +199,7 @@ module ActiveRecord
|
|
199
199
|
|
200
200
|
def destroy
|
201
201
|
case self.class.tableless_options[:database]
|
202
|
-
when :
|
202
|
+
when :pretend_success
|
203
203
|
@destroyed = true
|
204
204
|
freeze
|
205
205
|
when :fail_fast
|
@@ -209,7 +209,7 @@ module ActiveRecord
|
|
209
209
|
|
210
210
|
def reload(*args)
|
211
211
|
case self.class.tableless_options[:database]
|
212
|
-
when :
|
212
|
+
when :pretend_success
|
213
213
|
self
|
214
214
|
when :fail_fast
|
215
215
|
raise NoDatabase.new("Can't #reload a Tableless object")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-tableless
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -218,7 +218,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
218
218
|
version: '0'
|
219
219
|
segments:
|
220
220
|
- 0
|
221
|
-
hash:
|
221
|
+
hash: -619351809282407548
|
222
222
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
223
223
|
none: false
|
224
224
|
requirements:
|
@@ -227,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
227
227
|
version: '0'
|
228
228
|
segments:
|
229
229
|
- 0
|
230
|
-
hash:
|
230
|
+
hash: -619351809282407548
|
231
231
|
requirements: []
|
232
232
|
rubyforge_project:
|
233
233
|
rubygems_version: 1.8.24
|