Sha256: 3e71b7aec8ffda762b2bbfc2762a0b8e4ff34e59b85cc109028cf72327e293c9

Contents?: true

Size: 319 Bytes

Versions: 1

Compression:

Stored size: 319 Bytes

Contents

module ElocalApiSupport
  module Actions
    module Create
      def create
        params.permit!
        obj = associated_model.new(params[@model_name.to_sym])

        if obj.save
          render json: obj
        else
          render json: {errors: obj.errors}, status: 422
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
elocal_api_support-0.1.2 lib/elocal_api_support/actions/create.rb