Commit 11243fa7b0c225f3ca5216c2a799828f386605fb

Authored by Victor Costa
1 parent 9be28046

api: set user when vote

Showing 1 changed file with 2 additions and 2 deletions   Show diff stats
lib/noosfero/api/v1/articles.rb
@@ -34,8 +34,8 @@ module Noosfero @@ -34,8 +34,8 @@ module Noosfero
34 # FIXME verify allowed values 34 # FIXME verify allowed values
35 render_api_error!('Vote value not allowed', 400) unless [-1, 1].include?(value) 35 render_api_error!('Vote value not allowed', 400) unless [-1, 1].include?(value)
36 article = find_article(environment.articles, params[:id]) 36 article = find_article(environment.articles, params[:id])
37 - Vote.create!(:voteable => article, :voter => nil, :vote => value)  
38 - {:vote => true} 37 + vote = Vote.new(:voteable => article, :voter => current_person, :vote => value)
  38 + {:vote => vote.save}
39 end 39 end
40 40
41 get ':id/children' do 41 get ':id/children' do