Sha256: 57148415eb5335fb4aae850da78fd2985b9edcf696a86b328e779ce2c1d7ed9b

Contents?: true

Size: 772 Bytes

Versions: 1

Compression:

Stored size: 772 Bytes

Contents

require_dependency "landable/api_controller"

module Landable
  module Api
    class TemplatesController < ApiController
      def index
        respond_with Template.all
      end

      def create
        template = Template.new(template_params)
        template.save!
        respond_with template, status: :created, location: template_url(template)
      end

      def show
        respond_with Template.find(params[:id])
      end

      def update
        template = Template.find(params[:id])
        template.update_attributes! template_params
        respond_with template
      end

      private

      def template_params
        params.require(:template).permit(:id, :name, :body, :description, :thumbnail_url, :slug, :is_layout)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
landable-1.7.0 app/controllers/landable/api/templates_controller.rb