Sha256: 333b667a727cca11a715d4d78f715dc2fc81d7687979f0e487932a6a36261520

Contents?: true

Size: 815 Bytes

Versions: 7

Compression:

Stored size: 815 Bytes

Contents

module Neo4j
  module MetaModel
    module Meta
      class PropertiesController < ApplicationController
        before_action :get_property, only: [:edit, :show, :update, :destroy]

        def destroy
          @property.destroy

          render json: nil
        end

        def create
          property = Property.create(property_params)

          render json: property
        end

        def update
          @property.update_attributes(property_params)

          render json: @property
        end

        private

        def get_property
          @property = Property.find(params[:id])
        end

        def property_params
          model = params[:property].delete(:model_id)
          params.require(:property).permit(:name, :type).merge(model: model)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
neo4j-meta_model-0.3.0 app/controllers/neo4j/meta_model/meta/properties_controller.rb
neo4j-meta_model-0.2.2 app/controllers/neo4j/meta_model/meta/properties_controller.rb
neo4j-meta_model-0.2.1 app/controllers/neo4j/meta_model/meta/properties_controller.rb
neo4j-meta_model-0.2.0 app/controllers/neo4j/meta_model/meta/properties_controller.rb
neo4j-meta_model-0.1.2 app/controllers/neo4j/meta_model/meta/properties_controller.rb
neo4j-meta_model-0.1.1 app/controllers/neo4j/meta_model/meta/properties_controller.rb
neo4j-meta_model-0.1.0 app/controllers/neo4j/meta_model/meta/properties_controller.rb