Commit becb680b4fca77723841c0881a5bf1589cdf3b13

Authored by Leandro Santos
Committed by Rodrigo Souto
1 parent cdc871a0

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 33 conditions = {}
34 34 conditions[:type] = params[:content_type] if params[:content_type] #FIXME validate type
35 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 37 end
38 38  
39 39 desc "Return the article id"
40 40 get ':id' do
41   - present environment.articles.find(params[:id])
  41 + present environment.articles.find(params[:id]), , :with => Entities::Article
42 42 end
43 43  
44 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 46 end
47 47  
48 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 50 end
51 51  
52 52  
... ...