passive_record 0.3.21 → 0.3.22
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 +4 -4
- data/README.md +8 -3
- data/lib/passive_record/associations/has_many.rb +1 -13
- data/lib/passive_record/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0da60516f4dae347da57b1962d23e18b7f827afd
|
4
|
+
data.tar.gz: 1e0d9f45e271a7d7ea33f67c78a6025b775f0590
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9059fbac831a498e084e96369e4bff6f80eb1b4e49a62ec65781e352ee96d8dc65cfe5dba2055fa16f3de2257f9a853777f7325cd83c66746701c70dc310a192
|
7
|
+
data.tar.gz: 25776b650cee40da1991e5ece6c889c72914ecea5f86d9b389e83d094781f091e21168d05774a85552c9bc88096ff356cde6a949b370581f0f2880121fc866b3
|
data/README.md
CHANGED
@@ -200,11 +200,16 @@ PassiveRecord may be right for you!
|
|
200
200
|
|
201
201
|
- Approaches exist that use ActiveRecord directly, and then override various methods in such a way to prevent AR from
|
202
202
|
trying to persist the model. The canonical example here is the [tableless model](http://railscasts.com/episodes/193-tableless-model?view=asciicast)
|
203
|
-
approach, and the use case given there is a model that wraps around sending an email. This is maybe interesting because
|
204
|
-
|
203
|
+
approach, and the use case given there is a model that wraps around sending an email. This is maybe interesting because, similar to
|
204
|
+
the round-trip with a database, sending mail is externally "effectful" (and so, for instance, you may wish to take additional
|
205
205
|
care around confirmation or retry logic, in order ensure you are not sending the same message more than once.)
|
206
206
|
- These approaches are seen as somewhat hacky today, given that [ActiveModel](https://github.com/rails/rails/tree/master/activemodel) can
|
207
|
-
give plain old Ruby objects a lot of the augmentations that ActiveRecord gives, such as validations, hooks and attribute management.
|
207
|
+
give plain old Ruby objects a lot of the augmentations that ActiveRecord gives, such as validations, hooks and attribute management. However
|
208
|
+
I don't really see a way to do relations that interoperate with ActiveRecord the way you could, at least to some degree, with tableless models.
|
209
|
+
- It's not really clear to me yet if it's interesting for PassiveRecord to be able to interoperate smoothly with ActiveRecord relations. It
|
210
|
+
seems like we might be able to pull some similar tricks as the "tableless" approach in order to permit at least some relations to work between them.
|
211
|
+
But their intentions are so different I can't help but think there would be very strange bugs lurking in any such integration -- so the encouraged
|
212
|
+
architecture would be a complete separation between active and passive models.
|
208
213
|
|
209
214
|
## Copyright
|
210
215
|
|
@@ -19,19 +19,7 @@ module PassiveRecord
|
|
19
19
|
def all
|
20
20
|
child_class.where(parent_model_id_field => parent_model.id).all
|
21
21
|
end
|
22
|
-
def_delegators :all, :each
|
23
|
-
|
24
|
-
def last
|
25
|
-
all.last
|
26
|
-
end
|
27
|
-
|
28
|
-
def all?(*args)
|
29
|
-
all.all?(*args)
|
30
|
-
end
|
31
|
-
|
32
|
-
def empty?
|
33
|
-
all.empty?
|
34
|
-
end
|
22
|
+
def_delegators :all, :each, :last, :all?, :empty?
|
35
23
|
|
36
24
|
def where(conditions={})
|
37
25
|
child_class.where(conditions.merge(parent_model_id_field.to_sym => parent_model.id))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: passive_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joseph Weissman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|