partial_ks 0.4.0 → 0.4.1

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: 27cf67a4ac72c019e9ce39c13be6949746d319cb
4
- data.tar.gz: c8aaa05cf43a2c2a3bbc0d5076147ee2593f1d35
3
+ metadata.gz: 38febb0d43538e1c658e595dfa1b690669e9366b
4
+ data.tar.gz: f518ef601cb41bf1fc480e75269fdb2d7723c45e
5
5
  SHA512:
6
- metadata.gz: 41c5e26c8792bc97720b97aae22da1f4f0ca39014fc7e99b3eb20529557ffeb1dedd2015b164174acca8bf66a683ea0f2cd167b425bff7b04c237ab0c8f55873
7
- data.tar.gz: 4cbdfbb74cfb845bba856ff2db9bfead21222f42cb61df535404cb3b9b959ad44f8f56880615e9cf7c41770030ca6d15bf221828428e36fffd4b9e59d035bf6d
6
+ metadata.gz: 8dba5fdfc838d88f1bac8900d1e7e119da31868acbbe54103753a4c8cf9d6f5181bc1358c66ba7c66cdb993dd483519c8cb63a1d041a91b602373d7887be4985
7
+ data.tar.gz: 5eb5e046f03bf8fc15b31ca96d50966a591d5496d95d24ce47a00df83427e9d39f620709cbe7f2ec415310fe67291a4347ed0c4e7e0d8518f1c5ea41e66c5dda
data/CHANGES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ # 0.4.1
4
+
5
+ Fix issue where models which are missing their table would error out the whole process.
6
+
3
7
  # 0.4.0
4
8
 
5
9
  Allow lambdas to be used as a custom filter
data/CONTRIBUTING.md CHANGED
@@ -2,7 +2,7 @@ This document should tell all you need to know for contributing to this project.
2
2
 
3
3
  # Testing
4
4
 
5
- Tested with activerecord 4.2.7.1, 4.2.8 and 5.0.1 (on Ruby 2.3.3)
5
+ Tested with activerecord 4.2.7.1, 4.2.8 and 5.0.2 (on Ruby 2.3.3)
6
6
 
7
7
 
8
8
  To install and run tests :
@@ -3,7 +3,7 @@
3
3
  # and attempts to automatically populate the table into the table graph
4
4
  module PartialKs
5
5
  class ConfigurationGenerator
6
- attr_reader :manual_configuration, :models
6
+ attr_reader :manual_configuration
7
7
 
8
8
  def initialize(manual_configuration, models: nil)
9
9
  @manual_configuration = manual_configuration
@@ -19,6 +19,11 @@ module PartialKs
19
19
  @all_tables ||= models.map {|model| PartialKs::Table.new(model) }.select(&:model?).index_by(&:table_name)
20
20
  end
21
21
 
22
+ def models
23
+ tables_in_database = ActiveRecord::Base.connection.tables
24
+ @models.select{|model| tables_in_database.include?(model.table_name)}
25
+ end
26
+
22
27
  def filtered_tables
23
28
  synced_tables = {}
24
29
 
@@ -1,3 +1,3 @@
1
1
  module PartialKs
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
3
3
  end
@@ -38,4 +38,11 @@ describe "generating dependencies" do
38
38
  ["cms_table", nil, nil]
39
39
  ]
40
40
  end
41
+
42
+ it "does not choke on a table which has had its migration run" do
43
+ generator(manual_configuration, models: [User, NewModel]).
44
+ must_equal [
45
+ ["users", nil, User.where(:id => [1])],
46
+ ]
47
+ end
41
48
  end
data/test/setup_models.rb CHANGED
@@ -23,3 +23,8 @@ end
23
23
  class OldTag < ActiveRecord::Base
24
24
  belongs_to :old_entry, :foreign_key => 'blog_post_id'
25
25
  end
26
+
27
+ class NewModel < ActiveRecord::Base
28
+ # no tables, e.g. migration not run yet
29
+ belongs_to :user
30
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: partial_ks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thong Kuah
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-20 00:00:00.000000000 Z
11
+ date: 2017-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord