你能帮我重构和干燥吗?我没有想法。谢谢。
if request.xhr?
render :json => {
:status => true,
:location => root_url + "/projects",
:message => I18n.t("project.destroy")
}
else
flash[:notice] = I18n.t("project.destroy")
redirect_to :action => :index
end