Class: AccountsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/accounts_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/accounts_controller.rb', line 14

def create
  @plan = Plan.find(params[:plan_id])
  @signup = Signup.new(params[:signup])
  @signup.user = current_user
  @signup.plan = @plan
  if @signup.save
    Saucy::Configuration.notify("account_created", :request => request,
                                                   :account => @signup.)
    flash[:success] = "Account was created."
     @signup.user
    redirect_to (@signup.)
  else
    render :action => 'new'
  end
end

#destroyObject



53
54
55
56
57
# File 'app/controllers/accounts_controller.rb', line 53

def destroy
  .destroy
  flash[:success] = "Your account has been deleted."
  redirect_to root_url
end

#editObject



39
40
41
# File 'app/controllers/accounts_controller.rb', line 39

def edit
  @account = 
end

#indexObject



30
31
32
33
34
35
36
37
# File 'app/controllers/accounts_controller.rb', line 30

def index
  if current_user.projects.size == 1
    flash.keep
    redirect_to project_path(current_user.projects.first)
  else
    @accounts = current_user.accounts
  end
end

#newObject



7
8
9
10
11
12
# File 'app/controllers/accounts_controller.rb', line 7

def new
  @plan = Plan.find(params[:plan_id])
  @signup = Signup.new
  Saucy::Configuration.notify("plan_viewed", :request => request,
                                             :plan    => @plan)
end

#updateObject



43
44
45
46
47
48
49
50
51
# File 'app/controllers/accounts_controller.rb', line 43

def update
  @account = 
  if @account.update_attributes(params[:account])
    flash[:success] = 'Account was updated.'
    redirect_to edit_profile_url
  else
    render :action => :edit
  end
end