Created
December 10, 2010 12:23
-
-
Save sidwood/736143 to your computer and use it in GitHub Desktop.
Micro CMS Concept
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%w{rubygems sinatra haml sass dm-core}.each {|lib| require lib} | |
configure :production, :staging do | |
require 'dm-postgres-adapter' # for heroku | |
end | |
configure :development do | |
DataMapper.auto_upgrade! | |
end | |
configure do | |
DataMapper. | |
setup(:default, ENV['DATABASE_URL'] || "sqlite3://#{Dir.pwd}/data.db") | |
end | |
class Page | |
include DataMapper::Resource | |
property :id, Integer, :key => true | |
property :title, String, :required => true | |
property :keywords, String | |
property :description, String | |
property :uri, String, :required => true | |
property :body Text, :required => true | |
#TODO: Search and indexing | |
end | |
get '/' do | |
params[:uri] = 'home' | |
haml :page | |
end | |
get '/:uri' do | |
haml :page | |
end | |
post '/' do | |
@results = Page.search(params[:q]) | |
haml :results | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment