Sha256: 704e41dd775c325f1debb0c7c0b14382425c3cbfe0e06372924c6defca3034c6

Contents?: true

Size: 949 Bytes

Versions: 1

Compression:

Stored size: 949 Bytes

Contents

module MetaModel
  module Meta
    class HasAssociationsController < ApplicationController
      before_action :get_has_association, only: [:edit, :show, :update, :destroy]

      def index
        render json: HasAssociation.all
      end

      def show
        respond_to do |format|
          format.json { render json: @has_association }
        end
      end

      def create
        has_association = HasAssociation.create(has_association_params)

        create_models

        render json: has_association
      end

      def destroy
        @has_association.destroy

        create_models

        render json: nil
      end


      private

      def get_has_association
        @has_association = HasAssociation.find(params[:id])
      end

      def has_association_params
        params.require(:has_association).permit(:join_type, :name, :opposite_name, :relationship_type, :from_model_id, :to_model_id)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
neo4j-meta_model-0.0.1 app/controllers/meta_model/meta/has_associations_controller.rb