Can you help me for refactor and DRY that? I have no ideas. Thanks.
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
Well, you could overwrite redirect_to in application_controller.rb like this
and then keep using
in your controller.