igorgue (owner)

Revisions

gist: 224786 Download_button fork
public
Public Clone URL: git://gist.github.com/224786.git
Embed All Files: show embed
entries.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# controllers/entries.rb
 
get '/' do
  @entries = Post.all
 
  erb :index
end
 
get '/add' do
  erb :add
end
 
post '/add' do
  Post.find_or_create :title => params[:title], :body => params[:body]
 
  redirect "/"
end
 
get '/delete/?' do
  if params[:id]
    link = Link.find :id => params[:id]
 
    if link
      link.destroy
    end
  end
 
  redirect "/"
end