Do these two forms of ‘render’ have the same effect?
render 'contribute'
render :action => 'contribute'
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In short: Yes, they are the same.
However, sometimes passing a string will result in a call to
render :fileorrender :template.Here’s the API docs for the render function
If we scroll down and click ‘Show Source’ we can see what it’s doing under the hood.
Note the block starting at line 872:
By looking at this code, we can determine that it is trying to be smart.
/, (thewhen 0case) then it will callrender :file/at all, (thewhen nilcase) then it will callrender :action/somewhere in the middle or end of the string (thenelsecase), then it will callrender :templateHope this answers your question satisfactorily 🙂