# And end?

**URL:** <https://www.ruby-forum.com/t/and-end/113489>\
**Category:** Rails\
**Created:** [August 31, 2007, 5:55pm UTC](https://www.ruby-forum.com/t/and-end/113489 "2007-08-31T17:55:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![snantz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@snantz](https://www.ruby-forum.com/u/snantz)\
**Post date:** [August 31, 2007, 5:55pm UTC](https://www.ruby-forum.com/t/and-end/113489/1 "2007-08-31T17:55:03Z")

</div>

Im trying to remember the way in which you can call a method but tell it  
not to return and I think it was ‘and end,’ or something like that? An  
example would be,

render :partial =\> ‘test’, and end

Is that correct or did I dream this whole thing? Thanks,

-Shandy

---

<div class="post-metadata">

**Author:** ![snantz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@snantz](https://www.ruby-forum.com/u/snantz)\
**Post date:** [August 31, 2007, 6:20pm UTC](https://www.ruby-forum.com/t/and-end/113489/2 "2007-08-31T18:20:11Z")

</div>

On 8/31/07, Shandy N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Im trying to remember the way in which you can call a method but tell it  
> not to return and I think it was ‘and end,’ or something like that? An  
> example would be,
> 
> render :partial =\> ‘test’, and end
> 
> Is that correct or did I dream this whole thing? Thanks,

what do you mean “call a method but tell it not to return”? Do you  
not want the method to return a value? Do you not want the method to  
return at all, thereby blocking the process?

Adam

---

<div class="post-metadata">

**Author:** ![snantz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@snantz](https://www.ruby-forum.com/u/snantz)\
**Post date:** [August 31, 2007, 6:25pm UTC](https://www.ruby-forum.com/t/and-end/113489/3 "2007-08-31T18:25:11Z")

</div>

On Aug 31, 2007, at 12:19 PM, Adam C. wrote:

> > Is that correct or did I dream this whole thing? Thanks,
> 
> what do you mean “call a method but tell it not to return”? Do you  
> not want the method to return a value? Do you not want the method to  
> return at all, thereby blocking the process?
> 
> Adam

Going by your example and assuming that you just have it a bit wrong…

render :partial =\> ‘test’ and return

…which will do the render, but then return from the method (this is  
just Ruby syntax). The side-effect of this to avoid the rest of the  
method and is often used when doing error handling (like:  
redirect\_to :action =\> ‘index’ and return)

-Rob

Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![snantz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@snantz](https://www.ruby-forum.com/u/snantz)\
**Post date:** [August 31, 2007, 6:59pm UTC](https://www.ruby-forum.com/t/and-end/113489/4 "2007-08-31T18:59:36Z")

</div>

Rob B. wrote:

> On Aug 31, 2007, at 12:19 PM, Adam C. wrote:
> 
> > > Is that correct or did I dream this whole thing? Thanks,
> > 
> > what do you mean “call a method but tell it not to return”? Do you  
> > not want the method to return a value? Do you not want the method to  
> > return at all, thereby blocking the process?
> > 
> > Adam
> 
> Going by your example and assuming that you just have it a bit wrong…
> 
> render :partial =\> ‘test’ and return
> 
> …which will do the render, but then return from the method (this is  
> just Ruby syntax). The side-effect of this to avoid the rest of the  
> method and is often used when doing error handling (like:  
> redirect\_to :action =\> ‘index’ and return)
> 
> -Rob
> 
> Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
> removed\_email\_address@domain.invalid

and return, that’s it. What I want to happen is to check to see if a  
condition is met, like to many characters in a text field; if that’s  
true display an error message and start over, hence the ‘and return.’  
And maybe I might have the concept wrong in my head, but I was thinking  
that if it fails why continue, in which case just return. Thanks Rob
