Class: WhurlEngine::StoriesController

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

Instance Method Summary collapse

Instance Method Details

#createObject



11
12
13
14
15
16
# File 'app/controllers/whurl_engine/stories_controller.rb', line 11

def create
  @story = WhurlEngine::Story.new(params[:story])
  unless @story.save
    render :partial => 'whurl_engine/shared/error', :locals => {:object => @story}
  end
end

#destroyObject



29
30
31
32
33
34
# File 'app/controllers/whurl_engine/stories_controller.rb', line 29

def destroy
  @story = WhurlEngine::Story.find(params[:id])
  unless @story.destroy
    render :partial => 'whurl_engine/shared/error', :locals => {:object => @story}
  end
end

#editObject



18
19
20
# File 'app/controllers/whurl_engine/stories_controller.rb', line 18

def edit
  @story = WhurlEngine::Story.find(params[:id])
end

#indexObject



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

def index
  @stories = WhurlEngine::Story.all
end

#newObject



7
8
9
# File 'app/controllers/whurl_engine/stories_controller.rb', line 7

def new
  @story = WhurlEngine::Story.new
end

#updateObject



22
23
24
25
26
27
# File 'app/controllers/whurl_engine/stories_controller.rb', line 22

def update
  @story = WhurlEngine::Story.find(params[:id])
  unless @story.update_attributes(params[:story])
    render :partial => 'whurl_engine/shared/error', :locals => {:object => @story}
  end
end