lhs 3.3.0 → 3.3.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.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/lib/lhs.rb +9 -0
- data/lib/lhs/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: fd1aef2e3a2cb8b4cb273e04369ed4a09994b6d8
|
4
|
+
data.tar.gz: 353e924ff9e290477c4bbb80301d4c436bdcd94b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cb7b8f3c942672c4b0613d45191d24c35362c27239a74e1a6bc21acf61710f77c0aafc3a0962a20a5ecab3b250163287870ce879491e8c8792df5643c7fb3c5
|
7
|
+
data.tar.gz: 19fc0a566395731a6806e2abcb9bb0a78e88bab48b0129102953c675fb370c1325a6b7728b336b082fe1299d0a460ea8603827090cb1b2a0d9fe3ebcfa390574
|
data/README.md
CHANGED
@@ -275,9 +275,9 @@ class LocalEntry < LHS::Record
|
|
275
275
|
end
|
276
276
|
```
|
277
277
|
|
278
|
-
###
|
278
|
+
### Nested records
|
279
279
|
|
280
|
-
|
280
|
+
Nested records (in nested data) are automaticaly casted when the href matches any defined endpoint of any LHS::Record.
|
281
281
|
|
282
282
|
```
|
283
283
|
class Place < LHS::Record
|
@@ -296,6 +296,8 @@ favorite = Favorite.includes(:place).find(1)
|
|
296
296
|
favorite.place.name # local.ch AG
|
297
297
|
```
|
298
298
|
|
299
|
+
If automatic-detection of nested records does not work, make sure your LHS::Records are stored in `app/models`!
|
300
|
+
|
299
301
|
## Setters
|
300
302
|
|
301
303
|
You can change attributes of LHS::Records:
|
data/lib/lhs.rb
CHANGED
@@ -4,3 +4,12 @@ module LHS
|
|
4
4
|
end
|
5
5
|
|
6
6
|
Gem.find_files('lhs/**/*.rb').each { |path| require path }
|
7
|
+
|
8
|
+
# Preload all the LHS::Records that are defined in app/models
|
9
|
+
class Engine < Rails::Engine
|
10
|
+
initializer 'Load all LHS::Records from app/models/**' do |app|
|
11
|
+
Dir.glob(app.root.join('app/models/**/*.rb')).each do |file|
|
12
|
+
require file if File.read(file).scan('LHS::Record')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/lhs/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lhs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- https://github.com/local-ch/lhs/graphs/contributors
|
@@ -310,7 +310,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
310
310
|
requirements:
|
311
311
|
- Ruby >= 1.9.2
|
312
312
|
rubyforge_project:
|
313
|
-
rubygems_version: 2.
|
313
|
+
rubygems_version: 2.2.2
|
314
314
|
signing_key:
|
315
315
|
specification_version: 4
|
316
316
|
summary: Rails gem providing an easy, active-record-like interface to use http backend
|