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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/active_record/userstamp/utilities.rb +1 -1
- data/lib/active_record/userstamp/version.rb +1 -1
- data/spec/lib/stamping_spec.rb +11 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25999003ebd2edaa253de054a7cf31c0091337c4
|
4
|
+
data.tar.gz: ad8b9a16b548f5701814637f8c6809a8495e9409
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29dd1a0582f4b9644e12d8430d1282990cd5b0727c63c5e942961bd5b306c6e6237f043d2fb93b4509b7d5fd29f7378ab815eda3ad7951d1b56a0e7362594076
|
7
|
+
data.tar.gz: a3472cc8325eab9b076be7ad237305b8042d97d2759d87c2adf38a97b39f1d00c83106ebc4fe16a5ebcb47c5e20b4ee9365316a803b081c652d4e1d20973cd91
|
data/CHANGELOG.md
CHANGED
@@ -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
|
|
data/spec/lib/stamping_spec.rb
CHANGED
@@ -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)
|