5 months ago

http://nathanye.logdown.com/posts/1472023-study-notes-09-primary-exercise-3-13-extra-work-implement-points-button-and-the-about-page

  • <%= button_to '-1', downvote_topic_path(topic), method: :post %>

def downvote
@topic = Topic.find(params[:id])
@topic.votes.last.destroy
redirect_to(topics_path)
end

config/routes.rb + post 'downvote'

← 固定footer rails101 编辑删除按钮 →