Class: Buttafly::MappingsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/buttafly/mappings_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



35
36
37
38
39
40
41
42
# File 'app/controllers/buttafly/mappings_controller.rb', line 35

def create
  @mapping = Buttafly::Mapping.new(mapping_params)    
  if @mapping.update(originable_type: Buttafly.originable.to_s)
    redirect_to :back, notice: "mapping created"
  else
    redirect_to :back, notice: "not good"
  end
end

#destroyObject



26
27
28
29
30
31
32
33
# File 'app/controllers/buttafly/mappings_controller.rb', line 26

def destroy
  @mapping = Buttafly::Mapping.find(params[:id])
  if @mapping.destroy
    redirect_to :back, notice: "mapping destroyed"
  else
    redirect_to :back, notice: "can't destroy mapping"
  end
end

#editObject



17
18
# File 'app/controllers/buttafly/mappings_controller.rb', line 17

def edit
end

#indexObject



20
21
# File 'app/controllers/buttafly/mappings_controller.rb', line 20

def index
end

#newObject

before_action :set_originable, on: :new



8
9
10
11
12
# File 'app/controllers/buttafly/mappings_controller.rb', line 8

def new
  # binding.pry
  # @originable = Buttafly.originable.find(id: params[:originable_id])
  # legends = Mapping.where(targetable_model: params).map(&:legend_id)
end

#showObject



14
15
# File 'app/controllers/buttafly/mappings_controller.rb', line 14

def show
end

#updateObject



23
24
# File 'app/controllers/buttafly/mappings_controller.rb', line 23

def update
end