Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

34 lines (26 sloc) 0.844 kb
require 'sinatra'
require 'sinatra/activerecord'
require 'slim'
require 'will_paginate'
require 'will_paginate/active_record'
require 'redcarpet' # for processing markdown
require 'uri'
#--------------------Setup----------------------------------------------------#
require_relative 'helpers/init.rb'
require_relative 'models/init.rb'
require_relative 'routes/posts_route.rb'
use Rack::MethodOverride
#--------------------App_Routes-----------------------------------------------#
get '/' do
@posts = Post.where('published_at IS NOT NULL').order('published_at DESC').page(params[:page]).per_page(5)
slim :index
end
get '/show/:url' do
@post = Post.find_by_url(params[:url])
slim :show
end
get '/admin' do
protected!
@posts = Post.order('published_at DESC, created_at DESC').page(params[:page]).per_page(10)
slim :admin
end
Jump to Line
Something went wrong with that request. Please try again.