activerecord-userstamp 3.0.3 → 3.0.4

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
  SHA1:
3
- metadata.gz: 352c22aa4ca4d1dd7c9cc5ff0a7c3e9e2ccf9ba1
4
- data.tar.gz: bf2df186ca39cb6ff78370ac3eca3e9e13624b64
3
+ metadata.gz: 25999003ebd2edaa253de054a7cf31c0091337c4
4
+ data.tar.gz: ad8b9a16b548f5701814637f8c6809a8495e9409
5
5
  SHA512:
6
- metadata.gz: cb311b3579621119fa951df7a229e67bd3593bccf3a025e0e47ca1d6fd34b906e2dad3bf74474a7beb66929940a2ad463d928776c11f9256816c40b42a5d8d7e
7
- data.tar.gz: 4e7114880578dd234f11b25ed44c8773b44480037672b8895a8586bbfdb78c1dc269c6175c0296c3abe07bd080c57775434da4f89b41d14ad68ab38cd529479f
6
+ metadata.gz: 29dd1a0582f4b9644e12d8430d1282990cd5b0727c63c5e942961bd5b306c6e6237f043d2fb93b4509b7d5fd29f7378ab815eda3ad7951d1b56a0e7362594076
7
+ data.tar.gz: a3472cc8325eab9b076be7ad237305b8042d97d2759d87c2adf38a97b39f1d00c83106ebc4fe16a5ebcb47c5e20b4ee9365316a803b081c652d4e1d20973cd91
@@ -1,4 +1,8 @@
1
1
  # Changelog
2
+ ## 3.0.4 (14-7-2015)
3
+ * Joel Low - Allow using ActiveRecord-Userstamp with anonymous models (e.g. some
4
+ `has_and_belongs_to_many` join tables.)
5
+
2
6
  ## 3.0.3 (14-7-2015)
3
7
  * Joel Low - Allow using ActiveRecord-Userstamp with generated tables (e.g.
4
8
  `has_and_belongs_to_many` join tables.)
@@ -27,7 +27,7 @@ module ActiveRecord::Userstamp::Utilities
27
27
  # Otherwise, a tuple of booleans indicating the presence of the created, updated, and deleted
28
28
  # columns.
29
29
  def self.available_association_columns(model)
30
- return nil if model.table_name.empty?
30
+ return nil if model.name.nil? || model.table_name.empty?
31
31
  columns = Set[*model.column_names]
32
32
  config = ActiveRecord::Userstamp.config
33
33
 
@@ -1,4 +1,4 @@
1
1
  module ActiveRecord; end
2
2
  module ActiveRecord::Userstamp
3
- VERSION = '3.0.3'
3
+ VERSION = '3.0.4'
4
4
  end
@@ -240,6 +240,17 @@ RSpec.describe 'Stamping', type: :model do
240
240
  end
241
241
  end
242
242
 
243
+ context 'when using an anonymous model' do
244
+ it 'does not query the model on the columns' do
245
+ post_3_class = Class.new(ActiveRecord::Base) do
246
+ def self.table_name
247
+ 'Post'
248
+ end
249
+ end
250
+ expect(post_3_class.table_name).not_to be_empty
251
+ end
252
+ end
253
+
243
254
  context 'when a deleter attribute is specified' do
244
255
  it 'creates a deleter relation' do
245
256
  expect(@first_post.respond_to?('creator')).to eq(true)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-userstamp
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.3
4
+ version: 3.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Low