Skip to content

Instantly share code, notes, and snippets.

View ronualdo's full-sized avatar

Ronualdo Augusto Maciel ronualdo

View GitHub Profile
@ronualdo
ronualdo / frontend_api.rb
Last active July 10, 2018 15:41 — forked from ErvalhouS/frontend_api.rb
A read-only frontend API abstraction applicable to any application.
# frozen_string_literal: true
module Api
module V1
# Controller to consume read-only data to be used on client's frontend
class FrontEndController < ActionController::API
prepend_before_action :set_root_resource
before_action :set_object, except: %i[index schema]
append_before_action :set_nested_resource, only: %i[nested_index]
append_before_action :set_records, only: %i[index nested_index]