Class: Admin::MergeController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::MergeController
- Defined in:
- app/controllers/admin/merge_controller.rb
Instance Method Summary collapse
-
#attributes ⇒ Object
This is the AJAX request for the object’s attributes.
- #create ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
Instance Method Details
#attributes ⇒ Object
This is the AJAX request for the object’s attributes
44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/controllers/admin/merge_controller.rb', line 44 def attributes EffectiveMergery.(self, :admin, :effective_mergery) object = Effective::Merge.new(type: params[:type]).collection.find(params[:id]) if object.present? render partial: '/admin/merge/attributes', locals: { resource: object } else render body: '<p>None Available</p>' end end |
#create ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/admin/merge_controller.rb', line 25 def create EffectiveMergery.(self, :admin, :effective_mergery) @merge = Effective::Merge.new(merge_params) if @merge.save @page_title = 'Successful Merge' flash[:success] = "Successfully merged #{@merge}" @merge.target = @merge.collection.find(@merge.target_id) else @page_title = 'New Merge' flash.now[:danger] = "Unable to merge #{@merge}: #{@merge.errors..to_sentence}" render :new end end |
#index ⇒ Object
7 8 9 10 |
# File 'app/controllers/admin/merge_controller.rb', line 7 def index @page_title = 'Merges' EffectiveMergery.(self, :admin, :effective_mergery) end |
#new ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/admin/merge_controller.rb', line 12 def new @page_title = 'New Merge' EffectiveMergery.(self, :admin, :effective_mergery) begin @merge = Effective::Merge.new(type: params[:type]) @merge.validate_klass! rescue => e flash[:danger] = "An error occurred while loading #{@merge}: #{e.}" redirect_to effective_mergery.admin_merge_index_path end end |