This repository has been archived on 2024-12-01. You can view files and clone it, but cannot push or open issues or pull requests.
redmine_rodax_crm/app/models/contract_note.rb
2012-01-03 19:11:27 +00:00

24 lines
1.2 KiB
Ruby

class ContractNote < Note
unloadable
belongs_to :contract, :foreign_key => :source_id
acts_as_searchable :columns => ["#{table_name}.content"],
:include => [:contract => :project],
:project_key => "#{Project.table_name}.id",
:permission => :view_contracts,
# sort by id so that limited eager loading doesn't break with postgresql
:order_column => "#{table_name}.id"
acts_as_activity_provider :type => 'contacts',
:permission => :view_contracts,
:author_key => :author_id,
:find_options => {:include => [:contract => :project],
:conditions => {:source_type => 'Contract'}}
named_scope :visible, lambda {|*args| { :include => [:contract => :project],
:conditions => Project.allowed_to_condition(args.first || User.current, :view_contracts) +
" AND (#{ContractNote.table_name}.source_type = 'Contract')"} }
end