Tried to follow this tutorial off a scaffold using rspec
ruby
# GET /articles/1# GET /articles/1.jsondefshow@article = Article.find(params[:id])
if request.path != article_path(@article)
redirect_to @article, status::moved_permanentlyend
respond_to do |format|
format.html # show.html.erb
format.json { render json:@article }
endend
Threw the following failure:
ruby
1) ArticlesControllerGET show assigns the requested article as @articleFailure/Error: get :show, {:id => article.to_param}, valid_session
AbstractController::DoubleRenderError:
Renderand/or redirect were called multiple times in this action. Please note that you may only call render OR redirect, and at most once per action. Also note that neither redirect nor render terminate execution of the action, so if you want to exit an action after redirecting, you need to do something like "redirect_to(...) and return".
# ./app/controllers/articles_controller.rb:21:in`show'
# ./spec/controllers/articles_controller_spec.rb:55:in `block (3 levels) in <top (required)>'
Quick fix I'm using... but if there is a more eloquent way I'd love to know...
ruby
# GET /articles/1# GET /articles/1.jsondefshow@article = Article.find(params[:id])
if request.path != article_path(@article)
redirect_to @article, status::moved_permanentlyelse
respond_to do |format|
format.html # show.html.erb
format.json { render json:@article }
endendend
Nevermind - just realized my issue had to do with something else. I'd delete my comment above but I don't have the ability
Tried to follow this tutorial off a scaffold using rspec
Threw the following failure:
Quick fix I'm using... but if there is a more eloquent way I'd love to know...