It would be nice if you could change the :rabl option dynamically depending on a certain condition.
For example, if you have:
resource 'articles' do
get '/', :rabl => "articles" do
@article = Article.all
end
get ':id', :rabl => "article" do
@article = Article.find(params[:id])
end
end
You could do:
resource 'articles' do
get '/', :rabl => "articles" do
@article = Article.all
end
get ':id', :rabl => "article" do
@article = Article.find(params[:id])
if @article.category == "technology"
render :rabl => "article_with_technology"
end
end
end
such that the rendered rabl will depend on one or more specific article object attribute(s).
Is there a way using your gem to perform something close to the above?
It would be nice if you could change the :rabl option dynamically depending on a certain condition.
For example, if you have:
You could do:
such that the rendered rabl will depend on one or more specific article object attribute(s).
Is there a way using your gem to perform something close to the above?
Thanks, Michael