Module: Prefab::Controller

Extended by:
ActiveSupport::Concern
Defined in:
lib/prefab/controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



15
16
17
18
19
20
21
# File 'lib/prefab/controller.rb', line 15

def create
  if resource.save
    redirect_to resource, notice: save_success_message
  else
    render :new, alert: save_failed_message
  end
end

#destroyObject



31
32
33
34
# File 'lib/prefab/controller.rb', line 31

def destroy
  resource.destroy!
  redirect_back(fallback_location: root_path)
end

#editObject



13
# File 'lib/prefab/controller.rb', line 13

def  edit; end

#indexObject



10
# File 'lib/prefab/controller.rb', line 10

def index; end

#newObject



12
# File 'lib/prefab/controller.rb', line 12

def   new; end

#showObject



11
# File 'lib/prefab/controller.rb', line 11

def  show; end

#updateObject



23
24
25
26
27
28
29
# File 'lib/prefab/controller.rb', line 23

def update
  if resource.update(resource_params)
    redirect_to resource, notice: save_success_message
  else
    render :edit, alert: save_failed_message
  end
end