Commit be1b2334c9ad10742c2ace37741ab2ad2f7738cf
Committed by
Rodrigo Souto
1 parent
120ec078
Exists in
api_tasks
and in
4 other branches
return articles entities in article return
Showing
1 changed file
with
4 additions
and
4 deletions
Show diff stats
lib/api/v1/articles.rb
@@ -33,20 +33,20 @@ module API | @@ -33,20 +33,20 @@ module API | ||
33 | conditions = {} | 33 | conditions = {} |
34 | conditions[:type] = params[:content_type] if params[:content_type] #FIXME validate type | 34 | conditions[:type] = params[:content_type] if params[:content_type] #FIXME validate type |
35 | conditions[:created_at] = begin_period...end_period | 35 | conditions[:created_at] = begin_period...end_period |
36 | - present environment.articles.find(:all, :conditions => conditions, :offset => (from_date.nil? ? 0 : 1), :limit => limit, :order => "created_at DESC") | 36 | + present environment.articles.find(:all, :conditions => conditions, :offset => (from_date.nil? ? 0 : 1), :limit => limit, :order => "created_at DESC"), :with => Entities::Article |
37 | end | 37 | end |
38 | 38 | ||
39 | desc "Return the article id" | 39 | desc "Return the article id" |
40 | get ':id' do | 40 | get ':id' do |
41 | - present environment.articles.find(params[:id]) | 41 | + present environment.articles.find(params[:id]), , :with => Entities::Article |
42 | end | 42 | end |
43 | 43 | ||
44 | get ':id/children' do | 44 | get ':id/children' do |
45 | - present environment.articles.find(params[:id]).children | 45 | + present environment.articles.find(params[:id]).children.find(:all, :limit => limit), , :with => Entities::Article |
46 | end | 46 | end |
47 | 47 | ||
48 | get ':id/children/:child_id' do | 48 | get ':id/children/:child_id' do |
49 | - present environment.articles.find(params[:id]).children.find(params[:child_id]) | 49 | + present environment.articles.find(params[:id]).children.find(params[:child_id]), :with => Entities::Article |
50 | end | 50 | end |
51 | 51 | ||
52 | 52 |