vote-up-buttons

Thumbs_up gem rails - how to take back a vote?

不想你离开。 提交于 2019-12-23 05:08:47
问题 I finally got my votes being submitted correctly via ajax, however I can' seem to unvote at all. Here's my models: class User < ActiveRecord::Base acts_as_voter end class Vendor < ActiveRecord::Base acts_as_voteable end My routes: resources :vendors do collection do post :vote_for_vendor delete :vote_against_vendor end end My controller: class VendorsController < ApplicationController def vote_for_vendor begin vendor = Vendor.find(params[:vendor_id]) current_user.vote_for(vendor) render

Clarification on how to use “thumbs_up” voting gem with Rails 3

一个人想着一个人 提交于 2019-12-17 07:18:32
问题 I am attempting to implement the thumbs_up voting gem on a Rails 3 app, however the instructions are unclear on the actual implementation. After requiring the gem [ gem 'thumbs_up' ] and after creating and running the appropriate migration [ rails generate thumbs_up && rake db:migrate ] the README explains the following: To cast a vote for a Model you can do the following: *Shorthand syntax voter.vote_for(voteable) # Adds a +1 vote voter.vote_against(voteable) # Adds a -1 vote voter.vote

how to auto trigger my greasemonkey script every time i open a page

不问归期 提交于 2019-12-13 23:13:36
问题 this is my greasemonkey script. I want to auto-trigger it every time I open a reddit page. I want function up_vote_all() { vote_all('arrow up'); } to trigger on every page automatically without me click on the menu item. thanks // ==UserScript== // @name Reddit Mass Vote // @namespace http://reddit.com // @description You can up vote or down vote all comments on any page instantly without having to click each arrow. This is mainly to be used against spammers and trolls. // @include http://www

Clarification on how to use “thumbs_up” voting gem with Rails 3

此生再无相见时 提交于 2019-11-27 03:54:15
I am attempting to implement the thumbs_up voting gem on a Rails 3 app, however the instructions are unclear on the actual implementation. After requiring the gem [ gem 'thumbs_up' ] and after creating and running the appropriate migration [ rails generate thumbs_up && rake db:migrate ] the README explains the following: To cast a vote for a Model you can do the following: *Shorthand syntax voter.vote_for(voteable) # Adds a +1 vote voter.vote_against(voteable) # Adds a -1 vote voter.vote(voteable, vote) # Adds either a +1 or -1 vote: vote => true (+1), vote => false (-1) voter.vote_exclusively