And end?

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

On 8/31/07, Shandy N. [email protected] 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

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
[email protected]

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
[email protected]

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs