mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 03:58:27 +02:00
Improve unbinded invoice scope #2539
This commit is contained in:
parent
8f51d8a867
commit
194a551203
1 changed files with 3 additions and 1 deletions
|
@ -7,7 +7,9 @@ class Invoice < ActiveRecord::Base
|
|||
|
||||
accepts_nested_attributes_for :invoice_items
|
||||
|
||||
scope :unbinded, -> { where('id NOT IN (SELECT invoice_id FROM account_activities)') }
|
||||
scope :unbinded, lambda {
|
||||
where('id NOT IN (SELECT invoice_id FROM account_activities where invoice_id IS NOT NULL)')
|
||||
}
|
||||
|
||||
attr_accessor :billing_email
|
||||
validates :billing_email, format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i }, allow_blank: true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue