belongs_to_polymorphic 0.1.2 → 0.1.3

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: 72a7fc1cfa599890817ed887d3026bfe38a379e04011086704e9c011d493cacb
4
- data.tar.gz: 2d4f9da5474e4c6832f5bfd8c3414392f979018b3474c817ca65ab57a708c1fc
3
+ metadata.gz: 5d1c2af190a259601a400ab83fc7878d3ba1e9ba155d08920b687d41b551f2af
4
+ data.tar.gz: e00c21112f674af04124f846d56b9d5c611f29038490aa021ceba0bef87abdd6
5
5
  SHA512:
6
- metadata.gz: 281b3a89834676d4e7b70d8349be4a235b79de2933f5dd4e930fda96f84f7d3c3ed442ba089077afa56786bc8b1c21374fea0e0fcadcea5f2eac52fbefd560bc
7
- data.tar.gz: a97f89bc4f284cb7cb0eeacc339461ac5b329a937bfd919156da702fd1507234567154488faf42ef41edcaa0bb8f5e48c909baeee10f5b309752e7c301c72efc
6
+ metadata.gz: 7a3212e59e3449e9f2da0038cb45bb73b6d9ff212624145ee73a3b98f7f40933c774803008ee8581d6074fdef6aa5bef6d2985c30b3e1e0796daf8999d794ab0
7
+ data.tar.gz: bb848815e83b195207af66184440442f70416eaf09d90cf054c3a54ea96266d3812873f8ec81dae3567c82df5bf9164fbadb84ceb1cf995aaf43ef7c74c2a3c2
data/README.md CHANGED
@@ -74,6 +74,25 @@ en:
74
74
  class_not_allowed: "%{class} is not an allowed class"
75
75
  ```
76
76
 
77
+ ## Development
78
+
79
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
80
+
81
+ ## Contributing
82
+
83
+ Bug reports and pull requests are welcome on GitHub at https://github.com/gogrow-dev/belongs_to_polymorphic. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/gogrow-dev/belongs_to_polymorphic/blob/main/CODE_OF_CONDUCT.md).
84
+
77
85
  ## License
78
86
 
79
87
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
88
+
89
+ ## Code of Conduct
90
+
91
+ Everyone interacting in the belongs_to_polymorphic project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/gogrow-dev/belongs_to_polymorphic/blob/main/CODE_OF_CONDUCT.md).
92
+
93
+ ## Credits
94
+
95
+ belongs_to_polymorphic is maintained by [GoGrow](https://gogrow.dev) with the help of our
96
+ [contributors](https://github.com/gogrow-dev/belongs_to_polymorphic/contributors).
97
+
98
+ [<img src="https://user-images.githubusercontent.com/9309458/180014465-00477428-fd76-48f6-b984-5b401b8ce241.svg" height="50"/>](https://gogrow.dev)
@@ -8,8 +8,9 @@ module BelongsToPolymorphic
8
8
 
9
9
  module ClassMethods
10
10
  def belongs_to_polymorphic(name, allowed_classes:, **options)
11
- allowed_classes = Array.new(allowed_classes)
11
+ allowed_classes = Array.wrap(allowed_classes)
12
12
  belongs_to name, polymorphic: true, **options
13
+
13
14
  validates "#{name}_type", inclusion: {
14
15
  in: classes(allowed_classes, options),
15
16
  message: I18n.t('belongs_to_polymorphic.errors.messages.class_not_allowed',
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BelongsToPolymorphic
4
- VERSION = '0.1.2'
4
+ VERSION = '0.1.3'
5
5
  end
@@ -4,7 +4,7 @@ require 'active_record'
4
4
  require 'belongs_to_polymorphic/version'
5
5
  require 'belongs_to_polymorphic/associations'
6
6
 
7
- I18n.load_path << Dir["#{File.expand_path('config/locales')}/*.yml"]
7
+ I18n.load_path << File.expand_path('config/locales/en.yml')
8
8
 
9
9
  module BelongsToPolymorphic; end
10
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: belongs_to_polymorphic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Erlichman
@@ -113,11 +113,11 @@ files:
113
113
  - lib/belongs_to_polymorphic.rb
114
114
  - lib/belongs_to_polymorphic/associations.rb
115
115
  - lib/belongs_to_polymorphic/version.rb
116
- homepage: https://github.com/gogrow-dev/belongs_to_polymorphic
116
+ homepage: https://gogrow.dev
117
117
  licenses:
118
118
  - MIT
119
119
  metadata:
120
- source_code_uri: https://github.com/gogrow-dev/belongs_to_polymorphic
120
+ source_code_uri: https://gogrow.dev
121
121
  rubygems_mfa_required: 'true'
122
122
  post_install_message:
123
123
  rdoc_options: []