Refactor: Extract method

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3534 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Eric Davis 2010-03-04 05:33:35 +00:00
parent 976cba0c5d
commit ca6df3d78d
1 changed files with 7 additions and 3 deletions

View File

@ -68,22 +68,26 @@ class BoardsController < ApplicationController
@board.project = @project @board.project = @project
if request.post? && @board.save if request.post? && @board.save
flash[:notice] = l(:notice_successful_create) flash[:notice] = l(:notice_successful_create)
redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'boards' redirect_to_settings_in_projects
end end
end end
def edit def edit
if request.post? && @board.update_attributes(params[:board]) if request.post? && @board.update_attributes(params[:board])
redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'boards' redirect_to_settings_in_projects
end end
end end
def destroy def destroy
@board.destroy @board.destroy
redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'boards' redirect_to_settings_in_projects
end end
private private
def redirect_to_settings_in_projects
redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'boards'
end
def find_project def find_project
@project = Project.find(params[:project_id]) @project = Project.find(params[:project_id])
@board = @project.boards.find(params[:id]) if params[:id] @board = @project.boards.find(params[:id]) if params[:id]