Commit 5aa7a5fa14d9ba12b0588696449a5a89c60c1092

Authored by Leandro Santos
1 parent 4961f4d5

expose ranking and amount_of_children correctly

Showing 1 changed file with 5 additions and 15 deletions   Show diff stats
lib/ext/entities.rb
@@ -3,26 +3,16 @@ module Noosfero @@ -3,26 +3,16 @@ module Noosfero
3 module API 3 module API
4 module Entities 4 module Entities
5 5
6 - #FIXME make test  
7 - class ArticleBase < Entity 6 + class Article < ArticleBase
  7 +#FIXME Leandro changed the method to model
  8 +# expose :ranking_position do |article, options|
  9 +# article.kind_of?(ProposalsDiscussionPlugin::Proposal) && article.ranking_item.present? ? article.ranking_item.position : nil
  10 +# end
8 expose :ranking_position 11 expose :ranking_position
9 #FIXME see why children counter cache is not working 12 #FIXME see why children counter cache is not working
10 expose :amount_of_children do |article, options| 13 expose :amount_of_children do |article, options|
11 article.children.count 14 article.children.count
12 end 15 end
13 -  
14 - end  
15 -  
16 - def self.included(base)  
17 - base.extend(ClassMethods)  
18 - end  
19 -  
20 - module ClassMethods  
21 - class ArticleBase < Entity  
22 - expose :ranking_position do |article, options|  
23 - article.kind_of?(ProposalsDiscussionPlugin::Proposal) && article.ranking_item.present? ? article.ranking_item.position : nil  
24 - end  
25 - end  
26 end 16 end
27 17
28 end 18 end