29 lines
573 B
Ruby
29 lines
573 B
Ruby
|
|
class ComicsController < ApplicationController
|
||
|
|
|
||
|
|
caches_page :show
|
||
|
|
|
||
|
|
def index
|
||
|
|
@comics = Comic.find_latest.published
|
||
|
|
respond_to do |format|
|
||
|
|
format.html { redirect_to latest_comic }
|
||
|
|
format.rss
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|
||
|
|
def show
|
||
|
|
@comic = Comic.published.find_by_number(params[:id])
|
||
|
|
if @comic
|
||
|
|
@previous_comic = @comic.previous
|
||
|
|
@next_comic = @comic.next
|
||
|
|
else
|
||
|
|
@comic = Comic.published.find_by_id(params[:id])
|
||
|
|
if @comic
|
||
|
|
redirect_to @comic, :status => 301
|
||
|
|
else
|
||
|
|
render_404
|
||
|
|
end
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|
||
|
|
end
|