has_defaults 1.2.0 → 1.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4fb449c362751859cba75244e139688ecb2910493d04d2d7e169dcb95c519ddf
4
- data.tar.gz: 1dfc7ff69e71e7b8db9e5fed41755339f78b8a992391398899a1389646968ffa
3
+ metadata.gz: 699a82dd69eb3ae0e29640deef82f676973939af56412ac5ca976de1d6d73518
4
+ data.tar.gz: 48c12946f600f3becd44af5e2c8067e08fc802576d68fa2e9ca8b1e19385af1b
5
5
  SHA512:
6
- metadata.gz: a96e5636f4df55e20067f185f439d1314a1c6083719eb3d6b4ec56b5c9560ebc2cf8a0bd4eb5fc152a1a0f29f6d72ef1024a393dfc95b82b35c00acc9d466534
7
- data.tar.gz: 1c352ff44bc64ba36b7c8657faf44145b6548b285cd8cf0af473d7405e4420fa91016f4fc8f024593dc658c7c4f22429d2694866966bb5fc0c52388850399337
6
+ metadata.gz: 9aa21669bba0d8ab54f752702e5da7f3438f3dd1feb9a233d8ed095940a9575f11e2ae906bdcd5484897d0ebe41abfc60cdd0ab83806dcb97dcc4da76017bcce
7
+ data.tar.gz: cf3e65d6cd134ff80cd06af116f6200e360fef62ce5e40a6d87b96b7b0890a972fe0693513f1f6bf5006b9e65991a84c2735d684ce19f0552c1d5d9e17f4c1c5
data/CHANGELOG.md CHANGED
@@ -11,6 +11,13 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
11
11
  ### Compatible changes
12
12
 
13
13
 
14
+ ## 1.2.1 - 2024-10-25
15
+
16
+ ### Compatible changes
17
+
18
+ * Follow recommended way to extend Railties
19
+
20
+
14
21
  ## 1.2.0 - 2023-03-15
15
22
 
16
23
  ### Breaking changes
@@ -8,7 +8,7 @@ GIT
8
8
  PATH
9
9
  remote: .
10
10
  specs:
11
- has_defaults (1.2.0)
11
+ has_defaults (1.2.1)
12
12
  activerecord
13
13
 
14
14
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- has_defaults (1.2.0)
4
+ has_defaults (1.2.1)
5
5
  activerecord
6
6
 
7
7
  GEM
data/Gemfile.4.2.pg.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- has_defaults (1.2.0)
4
+ has_defaults (1.2.1)
5
5
  activerecord
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- has_defaults (1.2.0)
4
+ has_defaults (1.2.1)
5
5
  activerecord
6
6
 
7
7
  GEM
data/Gemfile.5.2.pg.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- has_defaults (1.2.0)
4
+ has_defaults (1.2.1)
5
5
  activerecord
6
6
 
7
7
  GEM
data/Gemfile.6.1.pg.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- has_defaults (1.2.0)
4
+ has_defaults (1.2.1)
5
5
  activerecord
6
6
 
7
7
  GEM
data/Gemfile.7.0.pg.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- has_defaults (1.2.0)
4
+ has_defaults (1.2.1)
5
5
  activerecord
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -6,13 +6,13 @@ Default values for ActiveRecord models.
6
6
 
7
7
  In your `Gemfile`
8
8
 
9
- ```
9
+ ```rb
10
10
  gem 'has_defaults'
11
11
  ```
12
12
 
13
13
  Now run
14
14
 
15
- ```
15
+ ```sh
16
16
  bundle install
17
17
  ```
18
18
 
@@ -20,7 +20,7 @@ bundle install
20
20
 
21
21
  Add the method call `has_defaults` to your model.
22
22
 
23
- ```
23
+ ```rb
24
24
  class Page < ActiveRecord::Base
25
25
  has_defaults :title => "New page", :body => "Put your text here"
26
26
  end
@@ -30,19 +30,19 @@ Attributes will be set only if it's a new record and the attribute is blank.
30
30
 
31
31
  Retrieve the default attribute with the `default_for` instance method:
32
32
 
33
- ```
33
+ ```rb
34
34
  @page.default_for(:title)
35
35
  ```
36
36
 
37
37
  You can pass Proc as attribute:
38
38
 
39
- ```
39
+ ```rb
40
40
  has_defaults :expires_at => proc { Time.now }
41
41
  ```
42
42
 
43
43
  You can override the default attributes as follow:
44
44
 
45
- ```
45
+ ```rb
46
46
  Page.has_defaults_options = {:title => "Here's your new page", :body => "Write your page text"}
47
47
  ```
48
48
 
@@ -76,6 +76,6 @@ module HasDefaults
76
76
  end
77
77
  end
78
78
 
79
- ActiveRecord::Base.extend(HasDefaults::ActiveRecordExt::ClassMethods)
80
-
81
-
79
+ ActiveSupport.on_load(:active_record) do
80
+ extend(HasDefaults::ActiveRecordExt::ClassMethods)
81
+ end
@@ -1,5 +1,5 @@
1
1
  module HasDefaults
2
2
 
3
- VERSION = '1.2.0'
3
+ VERSION = '1.2.1'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_defaults
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-15 00:00:00.000000000 Z
11
+ date: 2024-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord