has_accounts 0.17.4 → 0.17.5
Sign up to get free protection for your applications and to get access to all the features.
- data/app/models/account.rb +6 -1
- data/app/models/booking.rb +14 -0
- data/lib/has_accounts/version.rb +1 -1
- metadata +4 -4
data/app/models/account.rb
CHANGED
@@ -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)
|
data/app/models/booking.rb
CHANGED
@@ -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
|
|
data/lib/has_accounts/version.rb
CHANGED
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:
|
4
|
+
hash: 81
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 17
|
9
|
-
-
|
10
|
-
version: 0.17.
|
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-
|
18
|
+
date: 2012-02-10 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rails
|