Sha256: f4c1c5f1f21d766a27c72e2a5d6e5f2c5f864a949556c870ca838e2b33fcd199

Contents?: true

Size: 855 Bytes

Versions: 5

Compression:

Stored size: 855 Bytes

Contents

class InvitationsController < ApplicationController
  before_filter :authorize_admin, :except => [:show, :update]
  skip_before_filter :authenticate, :only => [:show, :update]
  layout Saucy::Layouts.to_proc

  def new
    @invitation = Invitation.new
    render
  end

  def create
    @invitation = Invitation.new(params[:invitation])
    @invitation.account = current_account
    if @invitation.save
      flash[:success] = "User invited."
      redirect_to account_memberships_url(current_account)
    else
      render :action => 'new'
    end
  end

  def show
    @invitation = Invitation.find(params[:id])
    render
  end

  def update
    @invitation = Invitation.find(params[:id])
    if @invitation.accept(params[:invitation])
      sign_in @invitation.user
      redirect_to root_url
    else
      render :action => 'show'
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
saucy-0.1.5 app/controllers/invitations_controller.rb
saucy-0.1.4 app/controllers/invitations_controller.rb
saucy-0.1.3 app/controllers/invitations_controller.rb
saucy-0.1.2 app/controllers/invitations_controller.rb
saucy-0.1.1 app/controllers/invitations_controller.rb