Sha256: 15cfa8263d7ec92ed0129054e1834fd26635a148440dc9624ebc424a71de1d34
Contents?: true
Size: 780 Bytes
Versions: 6
Compression:
Stored size: 780 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].present? @elements = @elements.where(page_id: params[:page_id]) end if params[:named].present? @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
6 entries across 6 versions & 2 rubygems