Merge pull request #312 from aboutsource/fix_out_of_range_amount_input
Avoid out of range error when using big numbers in financial transactions
This commit is contained in:
commit
93ece7fb05
1 changed files with 3 additions and 3 deletions
|
@ -3,9 +3,10 @@
|
||||||
class FinancialTransaction < ActiveRecord::Base
|
class FinancialTransaction < ActiveRecord::Base
|
||||||
belongs_to :ordergroup
|
belongs_to :ordergroup
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
validates_presence_of :amount, :note, :user_id, :ordergroup_id
|
validates_presence_of :amount, :note, :user_id, :ordergroup_id
|
||||||
validates_numericality_of :amount
|
validates_numericality_of :amount, greater_then: -100_000,
|
||||||
|
less_than: 100_000
|
||||||
|
|
||||||
localize_input_of :amount
|
localize_input_of :amount
|
||||||
|
|
||||||
|
@ -14,4 +15,3 @@ class FinancialTransaction < ActiveRecord::Base
|
||||||
ordergroup.add_financial_transaction! amount, note, user
|
ordergroup.add_financial_transaction! amount, note, user
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue