From 8ab9215ea8df2216ccfacf272804811b05ab82c8 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Tue, 11 Dec 2012 19:39:47 +0000 Subject: Use named routes in controllers. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10983 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/users_controller.rb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'app/controllers/users_controller.rb') diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index e6702a971..96c46fa36 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -101,10 +101,11 @@ class UsersController < ApplicationController respond_to do |format| format.html { flash[:notice] = l(:notice_user_successful_create, :id => view_context.link_to(@user.login, user_path(@user))) - redirect_to(params[:continue] ? - {:controller => 'users', :action => 'new'} : - {:controller => 'users', :action => 'edit', :id => @user} - ) + if params[:continue] + redirect_to new_user_path + else + redirect_to edit_user_path(@user) + end } format.api { render :action => 'show', :status => :created, :location => user_url(@user) } end @@ -171,7 +172,7 @@ class UsersController < ApplicationController def destroy @user.destroy respond_to do |format| - format.html { redirect_back_or_default(users_url) } + format.html { redirect_back_or_default(users_path) } format.api { render_api_ok } end end @@ -180,7 +181,7 @@ class UsersController < ApplicationController @membership = Member.edit_membership(params[:membership_id], params[:membership], @user) @membership.save respond_to do |format| - format.html { redirect_to :controller => 'users', :action => 'edit', :id => @user, :tab => 'memberships' } + format.html { redirect_to edit_user_path(@user, :tab => 'memberships') } format.js end end @@ -191,7 +192,7 @@ class UsersController < ApplicationController @membership.destroy end respond_to do |format| - format.html { redirect_to :controller => 'users', :action => 'edit', :id => @user, :tab => 'memberships' } + format.html { redirect_to edit_user_path(@user, :tab => 'memberships') } format.js end end -- cgit v1.2.3