conscious_concern 1.0.2 → 1.0.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
  SHA1:
3
- metadata.gz: 559534918c88c4e55b8113dd0dba18daa4e171bd
4
- data.tar.gz: b0a7671cd745e860db7c6274261f34d65fb610c5
3
+ metadata.gz: 38311a8767fe5fb909bcb0df55685ac8537b2039
4
+ data.tar.gz: 52248dc0fe825eafaf20cb14cbaaaf6e675d9979
5
5
  SHA512:
6
- metadata.gz: 1642114461e8557f63a3956315b7a88286587f77b05c69c1e336e646d0d351c9ed0b48aba1a41a1dfe0ef555a407dd5118434a53d281e425a1d13cf6a820d599
7
- data.tar.gz: aa93ab08efd2cf323d3c5fc02592fad8318d55c14e2fcee2f1ce293e899d26abb8de14a8533a22961ac393067b0d832a8f142a80df91bc5bae1c244439dff5cf
6
+ metadata.gz: 45059c9c9e8e72666f8a428268d691819ea833c2a0e4317fcb0c1db8b8b376340e616d5ca1d661c3d9d3c71b6cc9b57539d21cb56238a2e29ab5bdee698bc672
7
+ data.tar.gz: b44c47bcd9af6a5c136c6d93e90261e33dfc773b39609c882a9b40769c30bbccc2287edcec76dd776c69c3f9f90e77e1136d6e0f0e4bdaf54981a0eb1f75d3c1
@@ -52,7 +52,7 @@ module ConsciousConcern
52
52
  alias_method :_models, :models
53
53
 
54
54
  def resources(options = { only: [] }, &resource_routing_block)
55
- resource_args = _tables
55
+ resource_args = _undecorated_table_names
56
56
  app_routes_block = resource_routing_block.binding.eval('self')
57
57
  app_routes_block.instance_eval do
58
58
  resources(*resource_args, options, &resource_routing_block)
@@ -64,6 +64,11 @@ module ConsciousConcern
64
64
  end
65
65
  alias_method :_tables, :tables
66
66
 
67
+ def undecorated_table_names
68
+ _models.map { |model| model.try(:send, :undecorated_table_name) }.compact
69
+ end
70
+ alias_method :_undecorated_table_names, :undecorated_table_names
71
+
67
72
  def let_controllers(method_args_hash)
68
73
  _classes_loaded_callbacks << proc do
69
74
  method_args_hash.each do |method, args|
@@ -27,13 +27,15 @@ module ConsciousConcern
27
27
  end
28
28
 
29
29
  def self.load_class_at_path(path)
30
+ # silence harmless 'already initialized constant' warnings that might
31
+ # occur due to Rails autoload having previously loaded some constants.
30
32
  silence_warnings do
31
33
  require path
32
- clazz = File.basename(path, '.*').classify.constantize
33
- puts "eager loaded class '#{clazz}'" if debug
34
+ puts "eager loaded class at #{path}" if debug
34
35
  end
35
36
  rescue LoadError, StandardError => e
36
- puts e.message if debug
37
+ return puts(e.message) if debug
38
+ raise e unless e.message =~ /(previous definition|define multiple)/
37
39
  end
38
40
  end
39
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conscious_concern
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janosch Müller
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-11 00:00:00.000000000 Z
11
+ date: 2015-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -72,28 +72,28 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '3.3'
75
+ version: '3.4'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '3.3'
82
+ version: '3.4'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec-rails
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '3.3'
89
+ version: '3.4'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '3.3'
96
+ version: '3.4'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: sqlite3
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -143,3 +143,4 @@ signing_key:
143
143
  specification_version: 4
144
144
  summary: Enhances ActiveSupport::Concern
145
145
  test_files: []
146
+ has_rdoc: