Class: SparklyAccountsController

Inherits:
SparklyController show all
Defined in:
app/controllers/sparkly_accounts_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

POST model_url



10
11
12
13
14
15
16
17
# File 'app/controllers/sparkly_accounts_controller.rb', line 10

def create
  if model.save
    login!(model)
    redirect_back_or_default Auth.default_destination, Auth.
  else
    render :action => 'new'
  end
end

#destroyObject

DELETE model_url



42
43
44
45
46
47
48
# File 'app/controllers/sparkly_accounts_controller.rb', line 42

def destroy
  current_user && current_user.destroy
  logout!
  @current_user = nil
  flash[:notice] = Auth.
  redirect_back_or_default Auth.default_destination
end

#editObject

GET edit_model_url



24
25
# File 'app/controllers/sparkly_accounts_controller.rb', line 24

def edit
end

#newObject

GET new_model_url



6
7
# File 'app/controllers/sparkly_accounts_controller.rb', line 6

def new
end

#showObject

GET model_url



20
21
# File 'app/controllers/sparkly_accounts_controller.rb', line 20

def show
end

#updateObject

PUT model_url



28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/controllers/sparkly_accounts_controller.rb', line 28

def update
  if !model_params[:password].blank? || !model_params[:password_confirmation].blank?
    model.password = model_params[:password]
    model.password_confirmation = model_params[:password_confirmation]
  end
  
  if model.save
    redirect_back_or_default user_path, Auth.
  else
    render :action => 'edit'
  end
end