Sha256: a22074a83dff7f166810b2fd78f138f257aa0669f5e7241802e8ab1eaf133ede

Contents?: true

Size: 548 Bytes

Versions: 4

Compression:

Stored size: 548 Bytes

Contents

module Enlightenment
  class ValidationsController < Enlightenment::ApplicationController
    respond_to :json

    def create
      validation = Validation.new(params)

      if validation.pass?
        pass
      else
        fail(validation)
      end
    end

    private

      def pass(body = {})
        render(:json => body, :status => 201)
        # render(:text => true, :status => 201)
      end

      def fail(body = {})
        render(:json => body, :status => 403)
        # render(:json => body, :status => 200)
      end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
enlightenment-0.0.1.pre.4 app/controllers/enlightenment/validations_controller.rb
enlightenment-0.0.1.pre.3 app/controllers/enlightenment/validations_controller.rb
enlightenment-0.0.1.pre.2 app/controllers/enlightenment/validations_controller.rb
enlightenment-0.0.1.pre.1 app/controllers/enlightenment/validations_controller.rb