Class: Aspartame::AspartameUsersController

Inherits:
ApplicationController show all
Includes:
AspartameSessionsHelper
Defined in:
app/controllers/aspartame/aspartame_users_controller.rb

Instance Method Summary collapse

Methods included from AspartameSessionsHelper

#aspartame_current_user, #aspartame_current_user=, #aspartame_current_user?, #aspartame_redirect_back_or, #aspartame_sign_in, #aspartame_sign_out, #aspartame_signed_in?, #aspartame_signed_in_user, #aspartame_store_location

Instance Method Details

#createObject



20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/aspartame/aspartame_users_controller.rb', line 20

def create
  @aspartame_user = Aspartame::AspartameUser.new(params[:aspartame_user])
  if @aspartame_user.save
     @aspartame_user
    redirect_to aspartame.aspartame_users_path
    # render 'new'
  else
    render 'new'
  end
end

#destroyObject



31
32
33
34
35
# File 'app/controllers/aspartame/aspartame_users_controller.rb', line 31

def destroy
  Aspartame::AspartameUser.find(params[:id]).destroy
  flash[:success] = "AspartameUser destroyed."
  redirect_to aspartame_users_path
end

#editObject



37
38
39
# File 'app/controllers/aspartame/aspartame_users_controller.rb', line 37

def edit
	@aspartame_user = Aspartame::AspartameUser.find(params[:id])
end

#indexObject



56
57
58
# File 'app/controllers/aspartame/aspartame_users_controller.rb', line 56

def index
  @aspartame_users = Aspartame::AspartameUser.paginate(page: params[:page])
end

#newObject



16
17
18
# File 'app/controllers/aspartame/aspartame_users_controller.rb', line 16

def new
  @aspartame_user = Aspartame::AspartameUser.new
end

#showObject



12
13
14
# File 'app/controllers/aspartame/aspartame_users_controller.rb', line 12

def show
  @aspartame_user = Aspartame::AspartameUser.find(params[:id])
end

#updateObject



41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'app/controllers/aspartame/aspartame_users_controller.rb', line 41

def update
	@aspartame_user = Aspartame::AspartameUser.find(params[:id])
  # @aspartame_user.update_attributes(params[:aspartame_user])
  if @aspartame_user.update_attributes(params[:aspartame_user])
  	respond_to do |format|
      format.html { flash[:success] = "Profile successfully updated!"
      							redirect_to aspartame.edit_aspartame_user_path(@aspartame_user) 
      						}
      format.js
    end
  else
    render 'edit'
  end
end