Class: Locomotive::Api::SnippetsController
Instance Method Summary
collapse
#back_to_default_site_locale, #current_content_locale, #localized?, #set_back_office_locale, #set_current_content_locale, #setup_i18n_fallbacks
Instance Method Details
#create ⇒ Object
17
18
19
20
21
22
|
# File 'app/controllers/locomotive/api/snippets_controller.rb', line 17
def create
@snippet = current_site.snippets.new
@snippet.from_presenter(params[:snippet])
@snippet.save
respond_with @snippet, :location => main_app.locomotive_api_snippets_url
end
|
#destroy ⇒ Object
31
32
33
34
35
|
# File 'app/controllers/locomotive/api/snippets_controller.rb', line 31
def destroy
@snippet = current_site.snippets.find(params[:id])
@snippet.destroy
respond_with @snippet
end
|
#index ⇒ Object
7
8
9
10
|
# File 'app/controllers/locomotive/api/snippets_controller.rb', line 7
def index
@snippets = current_site.snippets.order_by([[:name, :asc]])
respond_with(@snippets)
end
|
#show ⇒ Object
12
13
14
15
|
# File 'app/controllers/locomotive/api/snippets_controller.rb', line 12
def show
@snippet = current_site.snippets.find(params[:id])
respond_with @snippet
end
|
#update ⇒ Object
24
25
26
27
28
29
|
# File 'app/controllers/locomotive/api/snippets_controller.rb', line 24
def update
@snippet = current_site.snippets.find(params[:id])
@snippet.from_presenter(params[:snippet])
@snippet.save
respond_with @snippet, :location => main_app.locomotive_api_snippets_url
end
|