deb 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,7 +12,7 @@ module Deb
12
12
  validate :credit_items_presence
13
13
  validate :proper_amounts
14
14
 
15
- attr_accessible :transactionable, :description
15
+ attr_accessible :transactionable, :description, :kind
16
16
 
17
17
  def self.start(&block)
18
18
  Docile.dsl_eval(Deb::Builder.new, &block).build
data/lib/deb/builder.rb CHANGED
@@ -18,6 +18,10 @@ module Deb
18
18
  @description = desc
19
19
  end
20
20
 
21
+ def kind(kind)
22
+ @kind = kind
23
+ end
24
+
21
25
  def reference(ref)
22
26
  @reference = ref
23
27
  end
@@ -28,7 +32,7 @@ module Deb
28
32
  end
29
33
 
30
34
  def build
31
- Deb::Transaction.new(description: @description, transactionable: @reference) do |t|
35
+ Deb::Transaction.new(description: @description, transactionable: @reference, kind: @kind) do |t|
32
36
  credits.each do |account, amount|
33
37
  t.credit_items.build(account: account, amount: amount)
34
38
  end
data/lib/deb/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Deb
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -14,10 +14,11 @@ class CreateDebTables < ActiveRecord::Migration
14
14
 
15
15
  create_table :deb_transactions do |t|
16
16
  t.string :description
17
+ t.string :kind, limit: 16
17
18
  t.references :transactionable, polymorphic: true
18
19
  t.timestamps
19
20
  end
20
- add_index :deb_transactions, [:transactionable_type, :transactionable_id], name: "deb_transactions_default"
21
+ add_index :deb_transactions, [:transactionable_type, :transactionable_id, :kind], name: "deb_transactions_default"
21
22
 
22
23
  create_table :deb_items do |t|
23
24
  t.string :kind
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -142,7 +142,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
142
142
  version: '0'
143
143
  segments:
144
144
  - 0
145
- hash: -1736791583155961067
145
+ hash: -3315931154693391300
146
146
  required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  none: false
148
148
  requirements:
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  version: '0'
152
152
  segments:
153
153
  - 0
154
- hash: -1736791583155961067
154
+ hash: -3315931154693391300
155
155
  requirements: []
156
156
  rubyforge_project:
157
157
  rubygems_version: 1.8.25