Sha256: a7649342c0d64bf6d0d051e767c57941f21da81cf841ade0f055ac4fe8e3bdaa

Contents?: true

Size: 1.5 KB

Versions: 10

Compression:

Stored size: 1.5 KB

Contents

module Abstractor
  module Methods
    module Controllers
      module AbstractorAbstractionGroupsController
        def self.included(base)
          base.send :helper, :all
        end

        def create
          @abstractor_abstraction_group = Abstractor::AbstractorAbstractionGroup.create(abstractor_subject_group_id: params[:abstractor_subject_group_id], about_type: params[:about_type], about_id: params[:about_id])
          @abstractor_abstraction_group.abstractor_subject_group.abstractor_subjects.each do |abstractor_subject|
            abstraction = abstractor_subject.abstractor_abstractions.build(about_id: params[:about_id], about_type: params[:about_type])
            abstraction.build_abstractor_abstraction_group_member(abstractor_abstraction_group: @abstractor_abstraction_group)
            abstraction.save!
          end

          respond_to do |format|
            format.html { render action: "edit", layout: false }
          end
        end

        def destroy
          abstractor_abstraction_group = Abstractor::AbstractorAbstractionGroup.find(params[:id])
          if abstractor_abstraction_group.soft_delete!
            flash[:notice] = "Group was successfully deleted."
          else
            flash[:error] = "Group could not be deactivated: #{abstractor_abstraction_group.errors.full_messages.join(',')}"
          end
          respond_to do |format|
            format.js   { head :no_content }
            format.json { head :no_content }
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
abstractor-1.0.17 lib/abstractor/methods/controllers/abstractor_abstraction_groups_controller.rb
abstractor-1.0.16 lib/abstractor/methods/controllers/abstractor_abstraction_groups_controller.rb
abstractor-1.0.15 lib/abstractor/methods/controllers/abstractor_abstraction_groups_controller.rb
abstractor-1.0.14 lib/abstractor/methods/controllers/abstractor_abstraction_groups_controller.rb
abstractor-1.0.13 lib/abstractor/methods/controllers/abstractor_abstraction_groups_controller.rb
abstractor-1.0.12 lib/abstractor/methods/controllers/abstractor_abstraction_groups_controller.rb
abstractor-1.0.11 lib/abstractor/methods/controllers/abstractor_abstraction_groups_controller.rb
abstractor-1.0.10 lib/abstractor/methods/controllers/abstractor_abstraction_groups_controller.rb
abstractor-1.0.9 lib/abstractor/methods/controllers/abstractor_abstraction_groups_controller.rb
abstractor-1.0.8 lib/abstractor/methods/controllers/abstractor_abstraction_groups_controller.rb