depository 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -80,6 +80,10 @@ module Depository
80
80
  end
81
81
  end
82
82
 
83
+ def join_as(table, *args, &blk)
84
+ select(*config.model._fields.map { |f| :"#{table}__#{f}"}).join(*args, &blk)
85
+ end
86
+
83
87
  private
84
88
 
85
89
  def new?(model)
@@ -7,6 +7,10 @@ module Depository
7
7
  class << self
8
8
  attr_protected :db
9
9
 
10
+ def self.db
11
+ dp.dup
12
+ end
13
+
10
14
  def use_db(db)
11
15
  self.db = db
12
16
  end
@@ -40,10 +40,8 @@ module Depository
40
40
  attrs = attrs.dup
41
41
 
42
42
  Depository::Database.db.schema(config.db).reject { |column, opts|
43
- attrs[column].nil?
44
- }.each do |column, opts|
45
- attrs[column] = attrs[column].to_i if opts[:type] == :integer
46
- end
43
+ attrs[column].nil? || opts[:type] != :integer
44
+ }.each { |column, opts| attrs[column] = attrs[column].to_i }
47
45
 
48
46
  attrs
49
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: depository
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: