Fixed: invalid SQL query on User#destroy (#1781).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1755 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
5ef0af6710
commit
6fc62d393c
|
@ -33,7 +33,8 @@ class User < ActiveRecord::Base
|
||||||
:username => '#{login}'
|
:username => '#{login}'
|
||||||
}
|
}
|
||||||
|
|
||||||
has_many :memberships, :class_name => 'Member', :include => [ :project, :role ], :conditions => "#{Project.table_name}.status=#{Project::STATUS_ACTIVE}", :order => "#{Project.table_name}.name", :dependent => :delete_all
|
has_many :memberships, :class_name => 'Member', :include => [ :project, :role ], :conditions => "#{Project.table_name}.status=#{Project::STATUS_ACTIVE}", :order => "#{Project.table_name}.name"
|
||||||
|
has_many :members, :dependent => :delete_all
|
||||||
has_many :projects, :through => :memberships
|
has_many :projects, :through => :memberships
|
||||||
has_many :issue_categories, :foreign_key => 'assigned_to_id', :dependent => :nullify
|
has_many :issue_categories, :foreign_key => 'assigned_to_id', :dependent => :nullify
|
||||||
has_one :preference, :dependent => :destroy, :class_name => 'UserPreference'
|
has_one :preference, :dependent => :destroy, :class_name => 'UserPreference'
|
||||||
|
|
|
@ -57,6 +57,12 @@ class UserTest < Test::Unit::TestCase
|
||||||
assert_equal "john", @admin.login
|
assert_equal "john", @admin.login
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_destroy
|
||||||
|
User.find(2).destroy
|
||||||
|
assert_nil User.find_by_id(2)
|
||||||
|
assert Member.find_all_by_user_id(2).empty?
|
||||||
|
end
|
||||||
|
|
||||||
def test_validate
|
def test_validate
|
||||||
@admin.login = ""
|
@admin.login = ""
|
||||||
assert !@admin.save
|
assert !@admin.save
|
||||||
|
|
Loading…
Reference in New Issue