Class: WhurlEngine::ChaptersController

Inherits:
ApplicationController show all
Defined in:
app/controllers/whurl_engine/chapters_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



7
8
9
10
11
12
# File 'app/controllers/whurl_engine/chapters_controller.rb', line 7

def create
  @chapter = WhurlEngine::Chapter.new(params[:chapter])
  unless @chapter.save
    render :partial => 'error'
  end
end

#destroyObject



25
26
27
28
29
30
# File 'app/controllers/whurl_engine/chapters_controller.rb', line 25

def destroy
  @chapter = WhurlEngine::Chapter.find(params[:id])
  unless @chapter.destroy
    render :partial => 'error'
  end
end

#editObject



14
15
16
# File 'app/controllers/whurl_engine/chapters_controller.rb', line 14

def edit
  @chapter = WhurlEngine::Chapter.find(params[:id])
end

#newObject



3
4
5
# File 'app/controllers/whurl_engine/chapters_controller.rb', line 3

def new
  @chapter = WhurlEngine::Chapter.new(:story_id => params[:story_id])
end

#updateObject



18
19
20
21
22
23
# File 'app/controllers/whurl_engine/chapters_controller.rb', line 18

def update
  @chapter = WhurlEngine::Chapter.find(params[:id])
  unless @chapter.update_attributes(params[:chapter])
    render :partial => 'error'
  end
end