Sha256: c6d3510c3cde93aa583689ef7854939e6e633a5fe328dce2a253d868f48d963d

Contents?: true

Size: 667 Bytes

Versions: 6

Compression:

Stored size: 667 Bytes

Contents

module FrontEndBuilds
  class ApplicationController < ActionController::Base

    def use_params(param_method)
      v = Rails::VERSION::MAJOR
      send("#{param_method}_rails_#{v}")
    end

    # Public: A quick helper to create a respond_to block for
    # returning json to the client. Used because `respond_with`
    # is no longer included in Rails.
    def respond_with_json(object, options = {})
      respond_to do |format|
        format.json do
          render options.merge(json: object)
        end
      end
    end

    def error!(errors, status = :unprocessable_entity)
      respond_with_json({ errors: errors }, status: status)
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
front_end_builds-0.2.1 app/controllers/front_end_builds/application_controller.rb
front_end_builds-0.2.0 app/controllers/front_end_builds/application_controller.rb
front_end_builds-0.1.3 app/controllers/front_end_builds/application_controller.rb
front_end_builds-0.1.2 app/controllers/front_end_builds/application_controller.rb
front_end_builds-0.1.1 app/controllers/front_end_builds/application_controller.rb
front_end_builds-0.1.0 app/controllers/front_end_builds/application_controller.rb