Commit 168fcdaeca2c076d0e9f6ecd044b3ca9edc849e3
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Merge branch 'api' into stable
Showing
2 changed files
with
3 additions
and
2 deletions
Show diff stats
lib/noosfero/api/entities.rb
... | ... | @@ -68,7 +68,8 @@ module Noosfero |
68 | 68 | expose :created_by, :as => :author, :using => Profile |
69 | 69 | expose :profile, :using => Profile |
70 | 70 | expose :categories, :using => Category |
71 | - expose :parent, :using => Article | |
71 | + # FIXME: create a method that overrides expose and include conditions for return attributes | |
72 | + expose :parent, :using => Article, :if => lambda { |article, options| options[:fields].blank? || options[:fields].include?(:parent) } | |
72 | 73 | expose :children, :using => ArticleChild |
73 | 74 | expose :image, :using => Image |
74 | 75 | end | ... | ... |
lib/noosfero/api/v1/articles.rb
... | ... | @@ -42,7 +42,7 @@ module Noosfero |
42 | 42 | article = find_article(environment.articles, params[:id]) |
43 | 43 | articles = select_filtered_collection_of(article, 'children', params) |
44 | 44 | articles = articles.display_filter(current_person, nil) |
45 | - present articles, :with => Entities::Article | |
45 | + present articles, :with => Entities::Article, :fields => [:id, :name, :abstract, :author] | |
46 | 46 | end |
47 | 47 | |
48 | 48 | get ':id/children/:child_id' do | ... | ... |