Description:
update errors.add_to_base("x") to Rails 3 errors.add(:base,"x")
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r347:6d2339b98fac - - 6 files changed: 12 inserted, 12 deleted
@@ -69,7 +69,7 | |||
|
69 | 69 | @submission.submitted_at = Time.new.gmtime |
|
70 | 70 | |
|
71 | 71 | if GraderConfiguration.time_limit_mode? and user.contest_finished? |
|
72 |
- @submission.errors.add |
|
|
72 | + @submission.errors.add(:base,"The contest is over.") | |
|
73 | 73 | prepare_list_information |
|
74 | 74 | render :action => 'list' and return |
|
75 | 75 | end |
@@ -26,7 +26,7 | |||
|
26 | 26 | |
|
27 | 27 | if GraderConfiguration.time_limit_mode? |
|
28 | 28 | if @user.contest_finished? |
|
29 |
- @submitted_test_request.errors.add |
|
|
29 | + @submitted_test_request.errors.add(:base,'Contest is over.') | |
|
30 | 30 | prepare_index_information |
|
31 | 31 | render :action => 'index' and return |
|
32 | 32 | end |
@@ -62,7 +62,7 | |||
|
62 | 62 | render :action => 'email_error', :layout => 'empty' |
|
63 | 63 | end |
|
64 | 64 | else |
|
65 |
- @user.errors.add |
|
|
65 | + @user.errors.add(:base,"Email cannot be blank") if @user.email=='' | |
|
66 | 66 | render :action => 'new', :layout => 'empty' |
|
67 | 67 | end |
|
68 | 68 | end |
@@ -44,7 +44,7 | |||
|
44 | 44 | import_params[:time_limit], |
|
45 | 45 | import_params[:memory_limit], |
|
46 | 46 | import_to_db) |
|
47 |
- problem.errors.add |
|
|
47 | + problem.errors.add(:base,'Import error.') | |
|
48 | 48 | end |
|
49 | 49 | |
|
50 | 50 | return problem, importer.log_msg |
@@ -77,17 +77,17 | |||
|
77 | 77 | DEFAULT_MEMORY_LIMIT) |
|
78 | 78 | |
|
79 | 79 | if time_limit<=0 or time_limit >60 |
|
80 |
- problem.errors.add |
|
|
80 | + problem.errors.add(:base,'Time limit out of range.') | |
|
81 | 81 | end |
|
82 | 82 | |
|
83 | 83 | if memory_limit==0 and params[:memory_limit]!='0' |
|
84 |
- problem.errors.add |
|
|
84 | + problem.errors.add(:base,'Memory limit format errors.') | |
|
85 | 85 | elsif memory_limit<=0 or memory_limit >512 |
|
86 |
- problem.errors.add |
|
|
86 | + problem.errors.add(:base,'Memory limit out of range.') | |
|
87 | 87 | end |
|
88 | 88 | |
|
89 | 89 | if params[:file]==nil or params[:file]=='' |
|
90 |
- problem.errors.add |
|
|
90 | + problem.errors.add(:base,'No testdata file.') | |
|
91 | 91 | end |
|
92 | 92 | |
|
93 | 93 | file = params[:file] |
@@ -70,12 +70,12 | |||
|
70 | 70 | |
|
71 | 71 | # checks if the user submits any input file |
|
72 | 72 | if params[:input_file]==nil or params[:input_file]=="" |
|
73 |
- test_request.errors.add |
|
|
73 | + test_request.errors.add(:base,"No input submitted.") | |
|
74 | 74 | test_request.input_file_name = nil |
|
75 | 75 | else |
|
76 | 76 | test_request.input_file_name = save_input_file(params[:input_file], user, problem) |
|
77 | 77 | if test_request.input_file_name == nil |
|
78 |
- test_request.errors.add |
|
|
78 | + test_request.errors.adds(:base,"No input submitted.") | |
|
79 | 79 | end |
|
80 | 80 | if params[:additional_file]!=nil and params[:additional_file]!="" |
|
81 | 81 | save_additional_file(params[:additional_file], |
@@ -298,7 +298,7 | |||
|
298 | 298 | def uniqueness_of_email_from_activated_users |
|
299 | 299 | user = User.activated_users.find_by_email(self.email) |
|
300 | 300 | if user and (user.login != self.login) |
|
301 |
- self.errors.add |
|
|
301 | + self.errors.add(:base,"Email has already been taken") | |
|
302 | 302 | end |
|
303 | 303 | end |
|
304 | 304 | |
@@ -309,7 +309,7 | |||
|
309 | 309 | :order => 'created_at DESC') |
|
310 | 310 | if open_user and open_user.created_at and |
|
311 | 311 | (open_user.created_at > Time.now.gmtime - 5.minutes) |
|
312 |
- self.errors.add |
|
|
312 | + self.errors.add(:base,"There are already unactivated registrations with this e-mail address (please wait for 5 minutes)") | |
|
313 | 313 | end |
|
314 | 314 | end |
|
315 | 315 |
You need to be logged in to leave comments.
Login now