model_discovery 0.3.2 → 0.3.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: d6d4f3b3e726b3a7ba133094dadd1fd8d572b870
4
- data.tar.gz: 53e90c8bc212a782760df14484d91700caf06e05
3
+ metadata.gz: 7c52d22f56f5cd262ea40437897830fd4d059d96
4
+ data.tar.gz: 4a39a66efa793278a529a24d50be2c8ebc62c62d
5
5
  SHA512:
6
- metadata.gz: 2ac2cf559eb73f60b11fbb7f44ca8a1f753c45022cc2d25f950b19e314a0422a59bd283aed2a6c7f0ae7ee0c0fc58d842666ae91b35995a920e6cde6fd4397f7
7
- data.tar.gz: 3e9492b2b47dcffe7952738723a9ae8521426d56a7d1cdee883e334713adc559212cb0d888d00578d408f44f1c3bfeb245dcab97179ad85c27896ad88030a87e
6
+ metadata.gz: 890b81d0086d594dc79c2239dae0421ea49cf6192309d114680a84edf9482d0022f1eff896607dda68b5bf8a6741b72bf50dfa84d2ccb8c65e5915afbaf7f164
7
+ data.tar.gz: 4298e62a1987b026c34854d86f57459b396096ec0b8812f90069a600e8bef83f6ac82cfddcaaac586c31d976084cf752c06fc6047659b06d0fa5a990ca079a61
@@ -1,7 +1,7 @@
1
1
  module ModelDiscovery
2
2
 
3
3
  # Create a list of current rails application tables or documents
4
- def self.build_table_list
4
+ def self.build_table_list(without_habtm = true)
5
5
  # Get all gem by requiring them
6
6
  all_gems = Bundler.require()
7
7
 
@@ -20,13 +20,18 @@ module ModelDiscovery
20
20
  if defined? ActiveRecord
21
21
  # Create a content type entry for all Models
22
22
  ActiveRecord::Base.subclasses.each do |model|
23
- ApplicationModels.find_or_create_by(model: model.to_s)
23
+ #unless model.name.to_s.starts_with? 'HABTM_'
24
+ if !model.name.to_s.starts_with?('HABTM_') && !without_habtm
25
+ ApplicationModels.find_or_create_by(model: model.name)
26
+ end
24
27
  end
25
28
  end
26
29
 
27
30
  if defined? Mongoid
28
31
  Mongoid.models.each do |model|
29
- ApplicationModels.find_or_create_by(model: model.to_s)
32
+ if !model.name.to_s.starts_with?('HABTM_') && !without_habtm
33
+ ApplicationModels.find_or_create_by(model: model.name)
34
+ end
30
35
  end
31
36
  end
32
37
  end
@@ -1,3 +1,3 @@
1
1
  module ModelDiscovery
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: model_discovery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sameer Rahmani
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-16 00:00:00.000000000 Z
11
+ date: 2014-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties