Archive: ComponentOwl Rails app, DB backups, go redirect script
This commit is contained in:
28
app/controllers/comics_controller.rb
Normal file
28
app/controllers/comics_controller.rb
Normal file
@@ -0,0 +1,28 @@
|
||||
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
|
||||
Reference in New Issue
Block a user