Sha256: 77004762a5b73b6c21a4a2f018b36aa1ed44e8c7b536e52746f5885154259557
Contents?: true
Size: 1.33 KB
Versions: 10
Compression:
Stored size: 1.33 KB
Contents
module Locomotive module Api class ContentEntriesController < BaseController before_filter :set_content_type def index @content_entries = @content_type.ordered_entries respond_with @content_entries end def show @content_entry = @content_type.entries.any_of({ :_id => params[:id] }, { :_slug => params[:id] }).first respond_with @content_entry, :status => @content_entry ? :ok : :not_found end def create @content_entry = @content_type.entries.create(params[:content_entry]) respond_with @content_entry, :location => main_app.locomotive_api_content_entries_url(@content_type.slug) end def update @content_entry = @content_type.entries.find(params[:id]) @content_entry.update_attributes(params[:content_entry]) respond_with @content_entry, :location => main_app.locomotive_api_content_entries_url(@content_type.slug) end def destroy @content_entry = @content_type.entries.find(params[:id]) @content_entry.destroy respond_with @content_entry, :location => main_app.locomotive_api_content_entries_url(@content_type.slug) end protected def set_content_type @content_type ||= current_site.content_types.where(:slug => params[:slug]).first end end end end
Version data entries
10 entries across 10 versions & 1 rubygems