engine/app/controllers/locomotive/api/snippets_controller.rb

25 lines
598 B
Ruby
Raw Normal View History

2012-01-23 08:05:50 +00:00
module Locomotive
module Api
class SnippetsController < BaseController
def index
@snippets = current_site.snippets.all
respond_with(@snippets)
end
def create
@snippet = current_site.snippets.create(params[:snippet])
respond_with @snippet, :location => main_app.locomotive_api_snippets_url
2012-01-23 08:05:50 +00:00
end
def update
@snippet = current_site.snippets.find(params[:id])
@snippet.update_attributes(params[:snippet])
respond_with @snippet, :location => main_app.locomotive_api_snippets_url
2012-01-23 08:05:50 +00:00
end
end
end
end