Sha256: 93a0040c386423400b4e23f7306ac60991cdb2a7a986d2e3ee07b00f5b612ba2
Contents?: true
Size: 762 Bytes
Versions: 7
Compression:
Stored size: 762 Bytes
Contents
module Alchemy class Api::ElementsController < Api::BaseController # Returns all elements as json object # # You can either load all or only these for :page_id param # # If you want to only load a specific type of element pass ?named=an_element_name # def index @elements = Element.accessible_by(current_ability, :index) if params[:page_id] @elements = @elements.where(page_id: params[:page_id]) end if params[:named] @elements = @elements.named(params[:named]) end respond_with @elements end # Returns a json object for element # def show @element = Element.find(params[:id]) authorize! :show, @element respond_with @element end end end
Version data entries
7 entries across 7 versions & 1 rubygems