Commit 5aa7a5fa14d9ba12b0588696449a5a89c60c1092
1 parent
4961f4d5
Exists in
master
and in
5 other branches
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 | 3 | module API |
| 4 | 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 | 11 | expose :ranking_position |
| 9 | 12 | #FIXME see why children counter cache is not working |
| 10 | 13 | expose :amount_of_children do |article, options| |
| 11 | 14 | article.children.count |
| 12 | 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 | 16 | end |
| 27 | 17 | |
| 28 | 18 | end | ... | ... |