Commit 1c90aa7a62ecaf19eda99599591d0aa4279ca1aa
1 parent
57e3afc1
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
rename parent parameter to parent_id
Showing
2 changed files
with
3 additions
and
3 deletions
Show diff stats
lib/noosfero/api/v1/search.rb
| @@ -19,7 +19,7 @@ module Noosfero | @@ -19,7 +19,7 @@ module Noosfero | ||
| 19 | 19 | ||
| 20 | scope = scope.where(:type => params[:type]) if params[:type] && !(params[:type] == 'Article') | 20 | scope = scope.where(:type => params[:type]) if params[:type] && !(params[:type] == 'Article') |
| 21 | 21 | ||
| 22 | - scope = scope.where(:parent_id => params[:parent]) if params[:parent].present? | 22 | + scope = scope.where(:parent_id => params[:parent_id]) if params[:parent_id].present? |
| 23 | 23 | ||
| 24 | category = params[:category] || "" | 24 | category = params[:category] || "" |
| 25 | 25 |
test/unit/api/search_test.rb
| @@ -110,11 +110,11 @@ class SearchTest < ActiveSupport::TestCase | @@ -110,11 +110,11 @@ class SearchTest < ActiveSupport::TestCase | ||
| 110 | parent = fast_create(Folder, :profile_id => person.id, :name => "parent", :published => true) | 110 | parent = fast_create(Folder, :profile_id => person.id, :name => "parent", :published => true) |
| 111 | art = fast_create(Article, :profile_id => person.id, :name => "child", :parent_id => parent.id) | 111 | art = fast_create(Article, :profile_id => person.id, :name => "child", :parent_id => parent.id) |
| 112 | art2 = fast_create(Article, :profile_id => person.id, :name => "child2") | 112 | art2 = fast_create(Article, :profile_id => person.id, :name => "child2") |
| 113 | - get "/api/v1/search/article?parent=#{parent.id}" | 113 | + get "/api/v1/search/article?parent_id=#{parent.id}" |
| 114 | json = JSON.parse(last_response.body) | 114 | json = JSON.parse(last_response.body) |
| 115 | assert_not_empty json['articles'] | 115 | assert_not_empty json['articles'] |
| 116 | assert_equal art.id, json['articles'].first["id"] | 116 | assert_equal art.id, json['articles'].first["id"] |
| 117 | assert_equal 1, json['articles'].count | 117 | assert_equal 1, json['articles'].count |
| 118 | end | 118 | end |
| 119 | 119 | ||
| 120 | -end | ||
| 121 | \ No newline at end of file | 120 | \ No newline at end of file |
| 121 | +end |