[phase-5]refactored redirect and flash message to oneline
This commit is contained in:
parent
06cc4908a5
commit
5d61bef881
@ -19,16 +19,14 @@ class GlossaryCategoriesController < ApplicationController
|
||||
def create
|
||||
category = GlossaryCategory.new(glossary_category_params)
|
||||
if category.save
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to category
|
||||
redirect_to category, notice: l(:notice_successful_create)
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
@category.attributes = glossary_category_params
|
||||
if @category.save
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to @category
|
||||
redirect_to @category, notice: l(:notice_successful_update)
|
||||
end
|
||||
rescue ActiveRecord::StaleObjectError
|
||||
flash.now[:error] = l(:notice_locking_conflict)
|
||||
|
@ -13,8 +13,7 @@ class GlossaryTermsController < ApplicationController
|
||||
def create
|
||||
term = GlossaryTerm.new(glossary_term_params)
|
||||
if term.save
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to term
|
||||
redirect_to term, notice: l(:notice_successful_create)
|
||||
end
|
||||
end
|
||||
|
||||
@ -24,8 +23,7 @@ class GlossaryTermsController < ApplicationController
|
||||
def update
|
||||
@term.attributes = glossary_term_params
|
||||
if @term.save
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_to @term
|
||||
redirect_to @term, notice: l(:notice_successful_update)
|
||||
end
|
||||
rescue ActiveRecord::StaleObjectError
|
||||
flash.now[:error] = l(:notice_locking_conflict)
|
||||
|
Loading…
Reference in New Issue
Block a user