As Kyle mentioned, you need to make sure that your Rails "API" layer supports having a publication_id as a parameter. You can do this either by modifying your config/routes
file or by checking for the presence of publication_id
in the Rails action.
For example, you probably have something like this:
class ArticlesController < ApplicationController
def index
@articles = Article.all
end
end
just change that to:
class ArticlesController < ApplicationController
def index
if params[:publication_id]
@articles = Article.where(:publication_id => params[:publication_id]).all
else
@articles = Article.all
end
end
end
This isn't idiomatic, usually you would just apply the where
's conditionally similar to ths answer here How to add conditional where clauses in rails but it'll work for this situation.