Class: Smithy::ContentResourcesController

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

Instance Method Summary collapse

Instance Method Details

#createObject



27
28
29
30
31
32
33
34
# File 'app/controllers/smithy/content_resources_controller.rb', line 27

def create
  @record = new_record
  @record.save
  flash.notice = "Your #{klass_name} was created" if @record.persisted?
  respond_with @record do |format|
    format.html { @record.persisted? ? redirect_to(:action => :index) : render(:action => 'new') }
  end
end

#destroyObject



50
51
52
53
54
55
# File 'app/controllers/smithy/content_resources_controller.rb', line 50

def destroy
  @record = find_record
  @record.destroy
  flash.notice = "Your #{klass_name} was deleted"
  respond_with @record
end

#editObject



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

def edit
  @record = find_record
  respond_with @record
end

#indexObject



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

def index
  @records = find_records
  respond_with @records
end

#newObject



22
23
24
25
# File 'app/controllers/smithy/content_resources_controller.rb', line 22

def new
  @record = new_record
  respond_with @record
end

#showObject



17
18
19
20
# File 'app/controllers/smithy/content_resources_controller.rb', line 17

def show
  @record = find_record
  respond_with @record
end

#updateObject



41
42
43
44
45
46
47
48
# File 'app/controllers/smithy/content_resources_controller.rb', line 41

def update
  @record = find_record
  @saved = update_record(@record)
  flash.notice = "Your #{klass_name} was saved" if @saved
  respond_with @page_content do |format|
    format.html { @saved ? redirect_to(:action => :index) : render(:action => "edit") }
  end
end