Commit f34e9ad3a135ee8c05b9cab16c1bcde6df06851a

Authored by Leandro Santos
Committed by Rodrigo Souto
1 parent c42ac8b4

solving bug create comment with person not user

Showing 2 changed files with 5 additions and 1 deletions   Show diff stats
lib/api/helpers.rb
... ... @@ -9,6 +9,10 @@ module API
9 9 @current_user
10 10 end
11 11  
  12 + def current_person
  13 + current_user.person unless current_user.nil?
  14 + end
  15 +
12 16 def logout
13 17 @current_user = nil
14 18 end
... ...
lib/api/v1/comments.rb
... ... @@ -28,7 +28,7 @@ module API
28 28 # Example Request:
29 29 # POST api/v1/articles/12/comments?private_toke=234298743290432&body=new comment
30 30 post ":id/comments" do
31   - present environment.articles.find(params[:id]).comments.create(:author => current_user, :body => params[:body]), :with => Entities::Comment
  31 + present environment.articles.find(params[:id]).comments.create(:author => current_person, :body => params[:body]), :with => Entities::Comment
32 32 end
33 33 end
34 34  
... ...