Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 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
Add Comment
Please, Sign In to add comment