has_accounts 0.17.4 → 0.17.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -50,7 +50,12 @@ class Account < ActiveRecord::Base
50
50
  def bookings
51
51
  Booking.by_account(id)
52
52
  end
53
-
53
+
54
+ # Attachments
55
+ # ===========
56
+ has_many :attachments, :as => :object
57
+ accepts_nested_attributes_for :attachments, :reject_if => proc { |attributes| attributes['file'].blank? }
58
+
54
59
  # Helpers
55
60
  # =======
56
61
  def self.overview(value_range = Date.today, format = :default)
@@ -11,6 +11,20 @@ class Booking < ActiveRecord::Base
11
11
  belongs_to :debit_account, :foreign_key => 'debit_account_id', :class_name => "Account"
12
12
  belongs_to :credit_account, :foreign_key => 'credit_account_id', :class_name => "Account"
13
13
 
14
+ def debit_account_code
15
+ debit_account.code
16
+ end
17
+ def debit_account_code=(value)
18
+ debit_account = Account.find_by_code(value)
19
+ end
20
+
21
+ def credit_account_code
22
+ credit_account.code
23
+ end
24
+ def credit_account_code=(value)
25
+ credit_account = Account.find_by_code(value)
26
+ end
27
+
14
28
  def direct_account
15
29
  return nil unless reference
16
30
 
@@ -1,3 +1,3 @@
1
1
  module HasAccounts
2
- VERSION = "0.17.4"
2
+ VERSION = "0.17.5"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_accounts
3
3
  version: !ruby/object:Gem::Version
4
- hash: 83
4
+ hash: 81
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 17
9
- - 4
10
- version: 0.17.4
9
+ - 5
10
+ version: 0.17.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Simon H\xC3\xBCrlimann (CyT)"
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-02-06 00:00:00 Z
18
+ date: 2012-02-10 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rails