head 1.8; access ; symbols ; locks ;comment @@; 1.8 date 2014.11.12.11.17.26; author p4; state Exp; branches ; next 1.7; 1.7 date 2014.11.12.11.06.44; author p4; state Exp; branches ; next 1.6; 1.6 date 2014.11.12.10.08.58; author p4; state Exp; branches ; next 1.4; 1.4 date 2014.11.11.12.43.56; author p4; state Exp; branches ; next ; desc @@ 1.8 log @@ text @class VotesController < ApplicationController def create @@article = Article.find(params[:article_id]) @@vote = @@article.votes.new(:article_id => params[:article_id], :up => params[:up], :from => request.remote_ip) if @@vote.save flash[:success] = "Thanks for voting" else flash[:error] = "Oops, didn't quite pan out" end redirect_to articles_path(:sort=>params[:sort]) end end @ 1.7 log @@ text @d4 5 a8 10 if Vote.exists?(article_id: @@article.id,from: request.remote_ip) flash[:success] = "You have already voted" else @@vote = @@article.votes.new(:article_id => params[:article_id], :up => params[:up], :from => request.remote_ip) if @@vote.save flash[:success] = "Thanks for voting" else flash[:error] = "Oops, didn't quite pan out" end @ 1.6 log @@ text @d4 10 a13 7 @@vote = @@article.votes.new(:article_id => params[:article_id], :up => params[:up], :from => request.remote_ip) if @@vote.save flash[:success] = "Thanks for voting" redirect_to articles_path(:sort=>params[:sort]) else flash[:error] = "Oops, didn't quite pan out" render :edit d15 1 @ 1.4 log @@ text @d4 1 a4 1 @@vote = @@article.votes.new(:article_id => params[:article_id], :up => params[:up] == true, :from => request.remote_ip) d7 1 a7 1 redirect_to articles_path @