Module: EIVO::Concerns::Resource

Extended by:
ActiveSupport::Concern
Defined in:
app/controllers/eivo/concerns/resource.rb

Instance Method Summary collapse

Instance Method Details

#createObject



16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/eivo/concerns/resource.rb', line 16

def create
  @object ||= collection.new
  @object.assign_attributes(object_params_create)

  if @object.save
    render :new
  else
    redirect_to action: :index
  end
end

#destroyObject



42
43
44
45
46
47
# File 'app/controllers/eivo/concerns/resource.rb', line 42

def destroy
  @object ||= collection

  @object.destroy
  redirect_to action: :index
end

#editObject



27
28
29
# File 'app/controllers/eivo/concerns/resource.rb', line 27

def edit
  @object ||= collection
end

#newObject



12
13
14
# File 'app/controllers/eivo/concerns/resource.rb', line 12

def new
  @object ||= collection.new
end

#showObject



8
9
10
# File 'app/controllers/eivo/concerns/resource.rb', line 8

def show
  @object ||= collection
end

#updateObject



31
32
33
34
35
36
37
38
39
40
# File 'app/controllers/eivo/concerns/resource.rb', line 31

def update
  @object ||= collection
  @object.assign_attributes(object_params_update)

  if @object.save
    render :edit
  else
    redirect_to action: :index
  end
end