Class: Buttafly::MappingsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Buttafly::MappingsController
- Defined in:
- app/controllers/buttafly/mappings_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
-
#new ⇒ Object
before_action :set_originable, on: :new.
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
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 |
#destroy ⇒ Object
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 |
#edit ⇒ Object
17 18 |
# File 'app/controllers/buttafly/mappings_controller.rb', line 17 def edit end |
#index ⇒ Object
20 21 |
# File 'app/controllers/buttafly/mappings_controller.rb', line 20 def index end |
#new ⇒ Object
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 |
#show ⇒ Object
14 15 |
# File 'app/controllers/buttafly/mappings_controller.rb', line 14 def show end |
#update ⇒ Object
23 24 |
# File 'app/controllers/buttafly/mappings_controller.rb', line 23 def update end |