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])
|
2012-01-24 20:16:53 +00:00
|
|
|
respond_with @snippet, :location => edit_locomotive_api_snippet_url(@snippet._id)
|
2012-01-23 08:05:50 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
|
|
|
@snippet = current_site.snippets.find(params[:id])
|
|
|
|
@snippet.update_attributes(params[:snippet])
|
2012-01-24 20:16:53 +00:00
|
|
|
respond_with @snippet, :location => edit_locomotive_api_snippet_url(@snippet._id)
|
2012-01-23 08:05:50 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|