app/models/entities/contact.rb in fat_free_crm-0.13.0 vs app/models/entities/contact.rb in fat_free_crm-0.13.1
- old
+ new
@@ -43,11 +43,11 @@
belongs_to :reporting_user, :class_name => "User", :foreign_key => :reports_to
has_one :account_contact, :dependent => :destroy
has_one :account, :through => :account_contact
has_many :contact_opportunities, :dependent => :destroy
has_many :opportunities, :through => :contact_opportunities, :uniq => true, :order => "opportunities.id DESC"
- has_many :tasks, :as => :asset, :dependent => :destroy#, :order => 'created_at DESC'
+ has_many :tasks, :as => :asset, :dependent => :destroy
has_one :business_address, :dependent => :destroy, :as => :addressable, :class_name => "Address", :conditions => "address_type = 'Business'"
has_many :addresses, :dependent => :destroy, :as => :addressable, :class_name => "Address" # advanced search uses this
has_many :emails, :as => :mediator
delegate :campaign, :to => :lead, :allow_nil => true
@@ -57,11 +57,11 @@
serialize :subscribed_users, Set
accepts_nested_attributes_for :business_address, :allow_destroy => true, :reject_if => proc {|attributes| Address.reject_address(attributes)}
- scope :created_by, ->(user) { where("user_id = ?", user.id) }
- scope :assigned_to, ->(user) { where("assigned_to = ?", user.id) }
+ scope :created_by, ->(user) { where( user_id: user.id ) }
+ scope :assigned_to, ->(user) { where( assigned_to: user.id ) }
scope :text_search, ->(query) {
t = Contact.arel_table
# We can't always be sure that names are entered in the right order, so we must
# split the query into all possible first/last name permutations.