Skip to content
Browse files

fix groups/users not being available after validation form validation

  • Loading branch information...
1 parent a0b9205 commit 73b67bd06633f23dfa7c28df3ca22e83e04a0619 @blahed committed Nov 15, 2012
View
4 app/controllers/admin/groups_controller.rb
@@ -1,6 +1,6 @@
class Admin::GroupsController < ApplicationController
before_filter :authorize_admin
-
+
def index
@groups = Group.all
end
@@ -16,6 +16,7 @@ def create
if @group.save
redirect_to admin_groups_path, :notice => 'Group created'
else
+ @users = User.all
render :new
end
end
@@ -35,6 +36,7 @@ def update
if @group.update_attributes(group_params)
redirect_to admin_groups_path, :notice => 'Group updated'
else
+ @users = User.all
render :edit
end
end
View
2 app/controllers/admin/users_controller.rb
@@ -16,6 +16,7 @@ def create
if @user.save
redirect_to admin_users_path, :notice => 'User created'
else
+ @groups = Group.all
render :new
end
end
@@ -35,6 +36,7 @@ def update
if @user.update_attributes(user_params)
redirect_to admin_users_path, :notice => 'User updated'
else
+ @groups = Group.all
render :edit
end
end
View
15 app/controllers/users_controller.rb
@@ -1,15 +0,0 @@
-class UsersController < ApplicationController
- def new
- @user = User.new
- end
-
- def create
- @user = User.new(params[:user])
- if @user.save
- session[:user_id] = @user.id
- redirect_to root_url, :notice => 'Thank you for signing up!'
- else
- render 'new'
- end
- end
-end

0 comments on commit 73b67bd

Please sign in to comment.
Something went wrong with that request. Please try again.