public
Description: OneBody is web-based software that connects community members, especially churches, on the web.
Homepage: http://beonebody.com
Clone URL: git://github.com/seven1m/onebody.git
Use add_errors_to_flash more consistently.
Tim Morgan (author)
Tue Aug 05 06:14:00 -0700 2008
commit  83b27eba03cce8f001d7b871292e47bb9ac1a512
tree    f60e47c0849aa9e637359e511aca85182391eee4
parent  774e4c1209c23c99a044f020e90f18929e69f787
...
13
14
15
16
17
18
 
19
20
21
...
13
14
15
 
 
 
16
17
18
19
0
@@ -13,9 +13,7 @@ class Administration::AdminsController < ApplicationController
0
         flash[:notice] = "#{person.name} is a Super Administrator."
0
       else
0
         person.admin = Admin.create!
0
-        unless person.save
0
-          flash[:warning] = person.errors.full_messages.join('; ')
0
-        end
0
+        add_errors_to_flash(person) unless person.save
0
       end
0
     end
0
     redirect_to admin_path
...
17
18
19
20
 
21
22
23
...
17
18
19
 
20
21
22
23
0
@@ -17,7 +17,7 @@ class Administration::UpdatesController < ApplicationController
0
           redirect_to administration_updates_path
0
         end
0
       else
0
-        flash[:warning] = "There was an error saving this update: #{@update.errors.full_messages.join('; ')}"
0
+        add_errors_to_flash(@update)
0
         index; render :action => 'index'
0
       end
0
     else
...
91
92
93
94
 
95
96
97
...
91
92
93
 
94
95
96
97
0
@@ -91,7 +91,7 @@ class PagesController < ApplicationController
0
     if @logged_in.can_edit?(@page)
0
       @page.destroy
0
       if @page.errors.any?
0
-        flash[:warning] = @page.errors.full_messages.join('; ')
0
+        add_errors_to_flash(@page)
0
       else
0
         flash[:notice] = 'Page deleted.'
0
       end
...
35
36
37
38
 
39
40
41
...
35
36
37
 
38
39
40
41
0
@@ -35,7 +35,7 @@ class PrivaciesController < ApplicationController
0
             flash[:warning] = "#{person.name} has been hidden from all pages on this site!"
0
           end
0
         else
0
-          flash[:notice] = person.errors.full_messages.join('; ')
0
+          add_errors_to_flash(person)
0
         end
0
       end
0
     elsif params[:family]
...
32
33
34
35
 
36
37
38
...
32
33
34
 
35
36
37
38
0
@@ -32,7 +32,7 @@ class Setup::SitesController < Setup::BaseController
0
         flash[:notice] = 'Site updated.'
0
         redirect_to setup_sites_url
0
       else
0
-        flash[:warning] = @site.errors.full_messages.join('; ')
0
+        add_errors_to_flash(@site)
0
       end
0
     end
0
   end

Comments