Class: Astrochimp::SignupsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Astrochimp::SignupsController
- Defined in:
- app/controllers/astrochimp/signups_controller.rb
Instance Method Summary collapse
Instance Method Details
#capture_referrer_code ⇒ Object
7 8 9 |
# File 'app/controllers/astrochimp/signups_controller.rb', line 7 def capture_referrer_code session[:referrer_id] = Signup.code_to_id(params[:referrer_code]) if params.has_key? :referrer_code end |
#create ⇒ Object
POST
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/astrochimp/signups_controller.rb', line 28 def create @signup = Signup.new(params[:signup].merge(referrer_id: session[:referrer_id])) @signup.status = Signup::STATUS_NEW respond_to do |format| @signup.save if @signup.errors.any? format.html { render action: :index } format.json { render json: @signup.errors, status: :unprocessable_entity } else SignupMailer.signup_complete(@signup).deliver format.html do flash[:signup_success] = ENV['AC_SIGNUP_SUCCESS_NOTICE'] redirect_to @signup, notice: ENV['AC_SIGNUP_SUCCESS_NOTICE'] end format.json { render json: @signup, status: :created, location: @signup } end end end |
#index ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'app/controllers/astrochimp/signups_controller.rb', line 14 def index @signup = Signup.new respond_to do |format| format.html # index.html.erb format.json { render json: @signup } end end |