Sha256: 4229fda6a3eda2b5ad30ab6103011adaa011ec502698cf5d00ed47ac7221b1f1

Contents?: true

Size: 848 Bytes

Versions: 1

Compression:

Stored size: 848 Bytes

Contents

require_dependency "astrochimp/application_controller"

module Astrochimp
  class SignupsController < ApplicationController
    def index
      @signup = Signup.new

      respond_to do |format|
        format.html # index.html.erb
        format.json { render json: @signup }
      end
    end

    # POST
    def create
      @signup = Signup.new(params[:signup])
      @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
          format.html { redirect_to root_url, notice: ENV['AC_SIGNUP_SUCCESS_NOTICE'] }
          format.json { render json: @signup, status: :created, location: @signup }
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
astrochimp-0.1.0 app/controllers/astrochimp/signups_controller.rb