Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- get '/articles' do
- articles = Article.all
- puts "Article number: #{articles.length}"
- haml :blog, :locals => { :articles => articles }
- end
- post '/articles' do
- article = Article.new
- article.id = params[:id]
- article.type = params[:type]
- article.type ||= 'Article'
- article.title = params[:title]
- article.slug = (s = params[:slug]) ? s : params[:title].downcase.gsub(' ','-')
- article.author = Author.get(params[:id])
- article.date = Date.parse params[:date]
- article.body = params[:body]
- article.save
- end
Add Comment
Please, Sign In to add comment