Sometimes I see this code:
def bar #...... if response && response.body #...... render(:text => html) and return end end
I wonder if it makes sense to use and returnat the very end of the method?
and return
I saw such code just not at the bottom of the method (this makes sense because the render is not the end of the method). But here I do not see the point.
See Avoid Double Render Mistakes .
This will help to avoid double render errors. Layouts and rendering
double render errors
, render, render , : Render and/or redirect were called multiple times in this action
render
Render and/or redirect were called multiple times in this action
, - , , :
def bar ... x = true ... if x render(:text => html) end ... render(:text => html) end
Source: https://habr.com/ru/post/1527503/More articles:Kinect IR Mute - kinectRemove \ r and \ n from AES encrypted string - javaCreating a valid site map with custom attributes - xmlhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1527501/save-opengl-screen-pixels-to-png-using-libpng&usg=ALkJrhhXwULioTXLlN__t8oBwy7c4AEKNQGoogle Sitemaps and Custom Tags - sitemaphttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1527504/amazon-rds-are-there-workarounds-to-change-a-database-time-zone-in-sql-server&usg=ALkJrhju247GHmOXRCeD6L4ewvCxmL00KQAssign with nullptr and zero size - c ++Coldfusion StructCopy Class & URL - coldfusionHow to get fps / frames per second of a video capture object - javaIs the withParameters parameter still supported in a request to a Breeze? - javascriptAll Articles