diff --git a/lib/noosfero/api/entities.rb b/lib/noosfero/api/entities.rb index 253a773..991458b 100644 --- a/lib/noosfero/api/entities.rb +++ b/lib/noosfero/api/entities.rb @@ -68,7 +68,8 @@ module Noosfero expose :created_by, :as => :author, :using => Profile expose :profile, :using => Profile expose :categories, :using => Category - expose :parent, :using => Article + # FIXME: create a method that overrides expose and include conditions for return attributes + expose :parent, :using => Article, :if => lambda { |article, options| options[:fields].blank? || options[:fields].include?(:parent) } expose :children, :using => ArticleChild expose :image, :using => Image end diff --git a/lib/noosfero/api/v1/articles.rb b/lib/noosfero/api/v1/articles.rb index 3d7bfcc..6ee4b3a 100644 --- a/lib/noosfero/api/v1/articles.rb +++ b/lib/noosfero/api/v1/articles.rb @@ -33,7 +33,7 @@ module Noosfero article = find_article(environment.articles, params[:id]) articles = select_filtered_collection_of(article, 'children', params) articles = articles.display_filter(current_person, nil) - present articles, :with => Entities::Article + present articles, :with => Entities::Article, :fields => [:id, :name, :abstract, :author] end get ':id/children/:child_id' do -- libgit2 0.21.2