Skip to content

Instantly share code, notes, and snippets.

@Dishwasha
Created July 21, 2009 14:09
Show Gist options
  • Save Dishwasha/151344 to your computer and use it in GitHub Desktop.
Save Dishwasha/151344 to your computer and use it in GitHub Desktop.
def create
@alert = current_user.alerts.build params[:alert]
if params[:send]
@alert.save
@alert.deliver
flash[:notice] = "Successfully sent the alert"
redirect_to logs_path
else
render :template => "alerts/preview"
end
end
def edit
alert = current_user.alerts.find params[:id]
@alert = present alert, :action => params[:_action]
render :template => "alerts/edit_with_#{params[:_action]}"
end
def cancel
@alert = current_user.alerts.find params[:id]
#original_alert = current_user.alerts.find params[:id]
#@alert = original_alert.build_cancellation params[:alert]
if params[:send]
#@alert.save
#@alert.deliver
flash[:notice] = "Successfully sent the alert"
redirect_to logs_path
else
render :template => "alerts/edit_with_cancel"
end
end
def create
@alert = current_user.alerts.build params[:alert]
if params[:send]
@alert.save
@alert.deliver
flash[:notice] = "Successfully sent the alert"
redirect_to logs_path
else
render :template => "alerts/preview"
end
end
def edit
alert = current_user.alerts.find params[:id]
@alert = present alert, :action => params[:_action]
render :template => "alerts/edit_with_#{params[:_action]}"
end
def cancel
@alert = current_user.alerts.find params[:id]
#original_alert = current_user.alerts.find params[:id]
#@alert = original_alert.build_cancellation params[:alert]
if params[:send]
#@alert.save
#@alert.deliver
flash[:notice] = "Successfully sent the alert"
redirect_to logs_path
else
render :template => "alerts/edit_with_cancel"
end
end
def create
@alert = current_user.alerts.build params[:alert]
if params[:send]
@alert.save
@alert.deliver
flash[:notice] = "Successfully sent the alert"
redirect_to logs_path
else
render :template => "alerts/preview"
end
end
def edit
alert = current_user.alerts.find params[:id]
@alert = present alert, :action => params[:_action]
render :template => "alerts/edit_with_#{params[:_action]}"
end
def cancel
@alert = current_user.alerts.find params[:id]
#original_alert = current_user.alerts.find params[:id]
#@alert = original_alert.build_cancellation params[:alert]
if params[:send]
#@alert.save
#@alert.deliver
flash[:notice] = "Successfully sent the alert"
redirect_to logs_path
else
render :template => "alerts/edit_with_cancel"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment