Class: BlueLightSpecial::UsersController

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

Instance Method Summary collapse

Instance Method Details

#createObject



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

def create
  @user = ::User.new params[:user]
  if @user.save
    (@user)
    flash[:notice] = 'You have successfully signed up.'
    redirect_back_or(url_after_create)
  else
    render :template => 'users/new'
  end
end

#editObject



41
42
43
44
# File 'app/controllers/blue_light_special/users_controller.rb', line 41

def edit
  @user = current_user
  render :template => 'users/edit'
end

#facebook_removeObject



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

def facebook_remove
  @fb_uid = params[:fb_sig_user] 
  if @fb_uid.present?
    # From here on it will be app specific -- given the facebook uid, destroy the user, like... 
    @user = User.find_by_facebook_uid(@fb_uid)
    @user.destroy if @user 
  end
  render :nothing => true; return 
end

#newObject



25
26
27
28
# File 'app/controllers/blue_light_special/users_controller.rb', line 25

def new
  @user = ::User.new(params[:user])
  render :template => 'users/new'
end

#showObject



20
21
22
23
# File 'app/controllers/blue_light_special/users_controller.rb', line 20

def show
  @user = current_user
  render :template => 'users/show'
end

#updateObject



46
47
48
49
50
51
52
53
54
# File 'app/controllers/blue_light_special/users_controller.rb', line 46

def update
  @user = current_user
  if @user.update_attributes(params[:user])
    flash[:success] = 'Your profile has been updated.'
    redirect_back_or(user_path(@user))
  else
    render :template => 'users/edit'
  end
end