Class: Sipity::Controllers::SipsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/sipity/controllers/sips_controller.rb

Overview

The controller for creating sips.

Instance Method Summary collapse

Methods inherited from ApplicationController

#message_for, #repository

Instance Method Details

#createObject



15
16
17
18
19
20
# File 'app/controllers/sipity/controllers/sips_controller.rb', line 15

def create
  status, model = run(attributes: create_params)
  @model = Decorators::SipDecorator.decorate(model)
  flash[:notice] = message_for(status, title: @model.title)
  respond_with(@model)
end

#create_paramsObject (private)



49
50
51
# File 'app/controllers/sipity/controllers/sips_controller.rb', line 49

def create_params
  params.require(:sip)
end

#editObject



28
29
30
31
# File 'app/controllers/sipity/controllers/sips_controller.rb', line 28

def edit
  _status, @model = run(sip_id: sip_id)
  respond_with(@model)
end

#newObject



9
10
11
12
13
# File 'app/controllers/sipity/controllers/sips_controller.rb', line 9

def new
  _status, model = run
  @model = Decorators::SipDecorator.decorate(model)
  respond_with(@model)
end

#showObject



22
23
24
25
26
# File 'app/controllers/sipity/controllers/sips_controller.rb', line 22

def show
  _status, model = run(sip_id: sip_id)
  @model = Decorators::SipDecorator.decorate(model)
  respond_with(@model)
end

#sip_idObject (private)



45
46
47
# File 'app/controllers/sipity/controllers/sips_controller.rb', line 45

def sip_id
  params.require(:id)
end

#updateObject



33
34
35
36
37
# File 'app/controllers/sipity/controllers/sips_controller.rb', line 33

def update
  status, @model = run(sip_id: sip_id, attributes: update_params)
  flash[:notice] = message_for(status, title: @model.title)
  respond_with(@model)
end

#update_paramsObject (private)



53
54
55
# File 'app/controllers/sipity/controllers/sips_controller.rb', line 53

def update_params
  params.require(:sip)
end