lhs 3.3.0 → 3.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -2
  3. data/lib/lhs.rb +9 -0
  4. data/lib/lhs/version.rb +1 -1
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f547564cf8d74f5da48573a93611abfce3435c33
4
- data.tar.gz: 6e2fa4f9d0e7fb231398c9e6fb316af72f247fb1
3
+ metadata.gz: fd1aef2e3a2cb8b4cb273e04369ed4a09994b6d8
4
+ data.tar.gz: 353e924ff9e290477c4bbb80301d4c436bdcd94b
5
5
  SHA512:
6
- metadata.gz: 128895810bed258280baca8b81c9c3d38f99b5f150e921852272ee053abff994396d45ee0cff617bc4678fcd4144b10612790e879f22cfcf6aedb631345ff656
7
- data.tar.gz: dab3d9af9b8d4806ac443c7f2fc55f1f5a8b5692d34233275bb4a6c3750902ee4f0a1d92fac5219dc1f753d6d61c8da5044f7dc2d1abd7abe7e08e3f0b65acb9
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
- ### Known LHS::Records when accessing mapped data from nested data
278
+ ### Nested records
279
279
 
280
- As LHS detects LHS::Records as soon as a link is present, mappings will also be applied on nested data:
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
@@ -1,3 +1,3 @@
1
1
  module LHS
2
- VERSION = "3.3.0"
2
+ VERSION = "3.3.1"
3
3
  end
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.0
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.5.1
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