Sha256: d1a8550f0fe779dfeb6771041da07cf633831ead3157ab77cbea1560545585f6
Contents?: true
Size: 1.32 KB
Versions: 2
Compression:
Stored size: 1.32 KB
Contents
require_dependency "astrochimp/application_controller" module Astrochimp class SignupsController < ApplicationController before_filter :capture_referrer_code, only: [:index] def capture_referrer_code session[:referrer_id] = Signup.code_to_id(params[:referrer_code]) if params.has_key? :referrer_code end # User's 'astrochimp_splash' layout in THEIR app (that uses this gem) layout "#{Rails.root}/app/views/layouts/#{ENV['AC_SPLASH_LAYOUT'] || 'astrochimp_splash'}" def index @signup = Signup.new respond_to do |format| format.html # index.html.erb format.json { render json: @signup } end end def show @signup = Signup.find(params[:id]) end # POST 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 format.html do redirect_to @signup, notice: ENV['AC_SIGNUP_SUCCESS_NOTICE'] end format.json { render json: @signup, status: :created, location: @signup } end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
astrochimp-0.1.3 | app/controllers/astrochimp/signups_controller.rb |
astrochimp-0.1.2 | app/controllers/astrochimp/signups_controller.rb |