Refactor
:my
=>
'code'
Codes
Refactorings
Popular
Best
Submit
Spam
Account
Logout
Login
JavaScript doesn't seem to be activated, expect things to be ugly and sloppy!
Learn How to Create Your Own Programming Language
createyourproglang.com
Recent
ALL FILE HOST PREMIUM ACCOUNTS
Zynga Slingo Trainer v5.12
iTunes Gift Card Generator V3.1 2012
Diablo 3 GOLD Coins FREE
Working PS3 Jailbreak 3.65 And 3.66
ExtaBit Premium Accounts and Cookies
Steam Wallet Hack - Money Adder & Hack v3
Empires & Allies Hack Cheat Trainer v5.4.1
Eve Onnline 60 Days Time Card Generator v2
Xbox Lve Generator v3
Popular
XBOX POINTS GENERATOR - MICROSOFT POINTS GENERATOR v1.2012
11 may 2012 premium uploading accounts 100% working
Free Microsoft Points
Free Microsoft Points - Microsoft Points Generator - Xbox Live Codes 2012
Car Town Free Blue Points Hack
Free CarTown Blue Points Generator and CarTown Templates
Better way to get content via jQuery $.get()
Free Microsoft Points
Simple Days Purger
Sharecash Downloader Bypass Surveys New 05/2012
Pastable version of
Step-REST uuuuugly controller
<pre class='prettyprint' language='ruby'>class CampaignsController < ApplicationController before_filter :load_campaign_or_redirect, :except => [:index, :sent, :new, :queued, :create, :processing] def index @campaigns = @current_user.campaigns.drafts end def sent @campaigns = @current_user.campaigns.sent end def new @campaign = Campaign.new end def create @campaign = Campaign.new(params[:campaign]) if @campaign.save redirect_to content_format_campaign_path(@campaign) else render :action => 'new' end end def edit; end def update respond_to do |format| if @campaign.update_attributes(params[:campaign]) flash[:notice] = 'Campaign has been updated.' format.html { redirect_to(@campaign) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @campaign.errors, :status => :unprocessable_entity } end end end def content_format; end def content_format_save if @campaign.update_attributes(params[:campaign]) if @campaign.format_of_campaign == 'html' redirect_to(html_source_campaign_path(@campaign)) elsif @campaign.format_of_campaign == 'text' redirect_to(text_content_campaign_path(@campaign)) end else render :action => 'content_format' end end def html_source; end def html_source_save if @campaign.update_attributes(params[:campaign]) if @campaign.content_injection_method == 'internet' redirect_to(import_url_campaign_path(@campaign)) elsif @campaign.content_injection_method == 'file' redirect_to(import_file_campaign_path(@campaign)) end else render :action => 'html_source' end end def import_file; end def import_file_save if @campaign.update_attributes(params[:campaign]) redirect_to(import_result_campaign_path(@campaign)) else render :action => 'import_file' end end def import_url; end def import_url_save @campaign.step = :step_import_url if @campaign.update_attributes(params[:campaign]) redirect_to(import_result_campaign_path(@campaign)) else render :action => 'import_url' end end def import_result; end def import_result_save if @campaign.update_attributes(params[:campaign]) render :action => 'import_result' else render :action => 'import_result' end end def text_content; end def text_content_save @campaign.step = :step_text_content if @campaign.update_attributes(params[:campaign]) redirect_to accept_content_campaign_path(@campaign) else render :action => 'text_content' end end def accept_content; end def recipients_source; end def recipients_source_save if @campaign.update_attributes(params[:campaign]) if @campaign.recipients_source == 'existing_list' redirect_to(select_lists_campaign_path(@campaign)) elsif @campaign.recipients_source == 'create_new_list' redirect_to(type_recipients_campaign_path(@campaign)) end else render :action => 'recipients_source' end end def type_recipients; end def type_recipients_save if @campaign.update_attributes(params[:campaign]) # some code for l8r else render :action => 'choose_recipients_source' end end def select_lists; end def select_lists_save if @campaign.update_attributes(params[:campaign]) redirect_to(recipients_import_result_campaign_path(@campaign)) else render :action => 'select_lists' end end def recipients_import_result; end def delivery_testing; end def send_test_email; end def schedule_delivery; end def schedule_delivery_save if @campaign.update_attributes(params[:campaign]) redirect_to(summary_campaign_path(@campaign)) else render :action => 'schedule_delivery' end end def summary; end def preview respond_to do |format| format.html { render :text => @campaign.body_html } format.text { render :text => @campaign.body_text } end end def show; end def processing if @current_user.campaigns.find(params[:id]).state != 'processing' redirect_to session[:return_path] end end private def load_campaign_or_redirect @campaign = @current_user.campaigns.find(params[:id]) if @campaign.state == 'processing' session[:return_path] = request.request_uri redirect_to processing_campaign_path(@campaign) end end end</pre> <a href="http://www.refactormycode.com/codes/286-step-rest-uuuuugly-controller" style="color:#fff" title="As seen on RefactorMyCode.com"><img alt="Small_logo" src="http://www.refactormycode.com/images/small_logo.gif" style="border:0" /></a>