Skip to content

Instantly share code, notes, and snippets.

View gist:8b19b55d03b362ee4220
<%= link_to "Upvote", vote_polls_path(poll, :vote_type => "upvotes"), :remote => true %>
<%= link_to "Downvote", vote_polls_path(poll, :vote_type => "downvotes"), :remote => true %>
# Add :vote to your set_poll before_action
def vote
@poll.increment!(params[:vote_type].to_sym) if ["upvotes", "downvotes"].include?(params[:vote_type])
end
@bchadfield
bchadfield / brief_pdf.rb
Created Mar 29, 2013
Example PDF class for Prawn
View brief_pdf.rb
class BriefPdf < Prawn::Document
def initialize(brief, user)
super(top_margin: 70, left_margin: 80, right_margin: 80, bottom_margin: 50)
@brief = brief
@user = user
header
company
contact
project
end