This commit is contained in:
2015-09-05 14:14:28 +02:00
parent 7336585416
commit e2e883df1d
24 changed files with 62 additions and 44 deletions
+3 -3
View File
@@ -5,10 +5,10 @@ module Users
#lists = current_user.lists.include_relation(:supplier, :table)
lists = List.for_user(current_user, page: params[:page], per_page: params[:per_page].presence || 25)
#lists.include_relation(:supplier)
lists.reject!{|l| l.id == params[:exclude_list]} if params[:exclude_list].present?
lists.reject!{|l| l.id == current_user.active_list_id } if current_user && current_user.active_list_id.present? # see spec Loading lists and switching to the order products view works, lists loading may unlink active list orders
#lists.reject!{|l| l.id == params[:exclude_list]} if params[:exclude_list].present?
#lists.reject!{|l| l.id == current_user.active_list_id } if current_user && current_user.active_list_id.present? # see spec Loading lists and switching to the order products view works, lists loading may unlink active list orders
lists.include_relation(:users, :supplier)
render json: JSONAPI::Serializer.serialize(lists, serializer: Users::ListSerializer, include: %w[supplier users], is_collection: true, meta: {total_pages: lists.total_pages, page: lists.current_page}) #, root: :lists
render json: JSONAPI::Serializer.serialize(lists, serializer: Users::ListSerializer, include: %w[supplier users], is_collection: true, meta: {total_pages: lists.total_count, page: lists.current_page}) #, root: :lists
end
#EMBER