Class: Smithy::ContentsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/smithy/contents_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



17
18
19
20
21
22
# File 'app/controllers/smithy/contents_controller.rb', line 17

def create
  @content = Smithy::Content.new(filtered_params)
  @content.save
  flash.notice = "Your content was created" if @content.persisted?
  respond_with @content
end

#destroyObject



35
36
37
38
39
# File 'app/controllers/smithy/contents_controller.rb', line 35

def destroy
  @content = Smithy::Content.find(params[:id])
  @content.destroy
  respond_with @content
end

#editObject



24
25
26
27
# File 'app/controllers/smithy/contents_controller.rb', line 24

def edit
  @content = Smithy::Content.find(params[:id])
  respond_with @content
end

#newObject



12
13
14
15
# File 'app/controllers/smithy/contents_controller.rb', line 12

def new
  @content = Smithy::Content.new(filtered_params)
  respond_with @content
end

#showObject



7
8
9
10
# File 'app/controllers/smithy/contents_controller.rb', line 7

def show
  @content = Smithy::Content.find(params[:id])
  respond_with @content
end

#updateObject



29
30
31
32
33
# File 'app/controllers/smithy/contents_controller.rb', line 29

def update
  @content = Smithy::Content.find(params[:id])
  flash.notice = "Your content was saved" if @content.update_attributes(filtered_params)
  respond_with @content
end