refer 0.5.1 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26dec8b5edf5b8021afc74684efb620ec85d17742e37e10f5f64a9d32eb964a0
4
- data.tar.gz: bd63be068604abc052e4160a66fdaf8b53da9d34f9f3f959e557a039e1bdd16d
3
+ metadata.gz: df22afceb80a13a9fa4f04bea4107628f39dc91a2d2d952f1aef86fe20196555
4
+ data.tar.gz: a2c77cbb2c59568fc7df60a0383f0daf0d7276869bda44b64cbf7be21b8f2649
5
5
  SHA512:
6
- metadata.gz: 503cb89b559261eeafe9cddb7de4352d2bff3d5677b72b5950a92f6dcb115066a9d0ab6def4bfb1bf9fe9bd40a08ad828b0b0082bcf48d7ec049786cdf5ad5db
7
- data.tar.gz: dae9b637b0666ccc4468e015b622b00094b804eff8aa2ef895938f16e7be4d1dc0fee95284915a5b8fb0a015ac6f1a4413b6b06cc663abdc79382c6fe7d426a7
6
+ metadata.gz: fd600da5fe3d3809e23444f5ffc839c337ce84cb1fd7495664660f257a4389b9f57344144059406b83c99906b9bf6c70b47b4eb4a393799b185bb3c8cde3ef17
7
+ data.tar.gz: 4750eaca271ed54939b0de254fbae45b8ee74ff967d32f907aca52064cb7508e1a9b4ccf91d2ac8a595b86b63e3585508e7a7403f58ee4ff2b8a72ce65e623fe
data/README.md CHANGED
@@ -48,7 +48,7 @@ user.referral_codes.create(code: "chris")
48
48
  To customize the referral code generator:
49
49
 
50
50
  ```ruby
51
- Refer.code_generator = ->(referrer) { [id, SecureRandom.alphanumeric(8)].join("-") }
51
+ Refer.code_generator = ->(referrer) { [referrer.id, SecureRandom.alphanumeric(8)].join("-") }
52
52
  #=> generates codes like "1-7frb5fUw"
53
53
  ```
54
54
 
@@ -6,7 +6,7 @@ module Refer
6
6
 
7
7
  validates :code, presence: true, uniqueness: true
8
8
 
9
- before_validation if: -> { Refer.code_generator } do
9
+ before_validation if: -> { !code? && Refer.code_generator } do
10
10
  self.code = Refer.code_generator.call(referrer)
11
11
  end
12
12
 
data/lib/refer/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Refer
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.3"
3
3
  end
data/lib/refer.rb CHANGED
@@ -5,6 +5,7 @@ require "securerandom"
5
5
  module Refer
6
6
  include ActiveSupport::Configurable
7
7
 
8
+ autoload :Controller, "refer/controller"
8
9
  autoload :HasReferrals, "refer/has_referrals"
9
10
  autoload :Model, "refer/model"
10
11
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-30 00:00:00.000000000 Z
11
+ date: 2024-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -34,7 +34,6 @@ files:
34
34
  - MIT-LICENSE
35
35
  - README.md
36
36
  - Rakefile
37
- - app/controllers/concerns/refer/controller.rb
38
37
  - app/models/refer/application_record.rb
39
38
  - app/models/refer/referral.rb
40
39
  - app/models/refer/referral_code.rb
@@ -48,6 +47,7 @@ files:
48
47
  - lib/generators/refer/model/USAGE
49
48
  - lib/generators/refer/model/model_generator.rb
50
49
  - lib/refer.rb
50
+ - lib/refer/controller.rb
51
51
  - lib/refer/engine.rb
52
52
  - lib/refer/has_referrals.rb
53
53
  - lib/refer/model.rb