comparison app/models/issue_category.rb @ 929:5f33065ddc4b redmine-1.3

Update to Redmine SVN rev 9414 on 1.3-stable branch
author Chris Cannam
date Wed, 27 Jun 2012 14:54:18 +0100
parents cbb26bc654de
children 433d4f72a19b
comparison
equal deleted inserted replaced
909:cbb26bc654de 929:5f33065ddc4b
14 # You should have received a copy of the GNU General Public License 14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software 15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 class IssueCategory < ActiveRecord::Base 18 class IssueCategory < ActiveRecord::Base
19 include Redmine::SafeAttributes
19 belongs_to :project 20 belongs_to :project
20 belongs_to :assigned_to, :class_name => 'Principal', :foreign_key => 'assigned_to_id' 21 belongs_to :assigned_to, :class_name => 'Principal', :foreign_key => 'assigned_to_id'
21 has_many :issues, :foreign_key => 'category_id', :dependent => :nullify 22 has_many :issues, :foreign_key => 'category_id', :dependent => :nullify
22 23
23 validates_presence_of :name 24 validates_presence_of :name
24 validates_uniqueness_of :name, :scope => [:project_id] 25 validates_uniqueness_of :name, :scope => [:project_id]
25 validates_length_of :name, :maximum => 30 26 validates_length_of :name, :maximum => 30
26 27
27 attr_protected :project_id 28 safe_attributes 'name', 'assigned_to_id'
28 29
29 named_scope :named, lambda {|arg| { :conditions => ["LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip]}} 30 named_scope :named, lambda {|arg| { :conditions => ["LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip]}}
30 31
31 alias :destroy_without_reassign :destroy 32 alias :destroy_without_reassign :destroy
32 33