Class: My::ProfilesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/profiled/my/profiles_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/profiled/my/profiles_controller.rb', line 10

def create
  @profile = current_user.profiles.build(profile_params)

  if @profile.save
    render 'create'
  else
    prepare_form
    render :new
  end
end

#destroyObject



38
39
# File 'app/controllers/profiled/my/profiles_controller.rb', line 38

def destroy
end

#editObject



24
25
26
# File 'app/controllers/profiled/my/profiles_controller.rb', line 24

def edit
  prepare_form
end

#newObject



5
6
7
8
# File 'app/controllers/profiled/my/profiles_controller.rb', line 5

def new
  @profile = current_user.profiles.build
  prepare_form
end

#showObject



21
22
# File 'app/controllers/profiled/my/profiles_controller.rb', line 21

def show
end

#updateObject



28
29
30
31
32
33
34
35
36
# File 'app/controllers/profiled/my/profiles_controller.rb', line 28

def update
  @profile.assign_attributes profile_params

  if @profile.save
    render 'update'
  else
    render :edit, locals: { model: @profile }, status: :unprocessable_entity
  end
end