# Force refresh

**URL:** <https://www.ruby-forum.com/t/force-refresh/112529>\
**Category:** Rails\
**Created:** [August 20, 2007, 6:20pm UTC](https://www.ruby-forum.com/t/force-refresh/112529 "2007-08-20T18:20:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![smithy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a4c791/32.png) [@smithy](https://www.ruby-forum.com/u/smithy)\
**Post date:** [August 20, 2007, 6:20pm UTC](https://www.ruby-forum.com/t/force-refresh/112529/1 "2007-08-20T18:20:29Z")

</div>

Hello,  
Im new with Ruby on Rails and have a problem. I need to force a refresh  
of the page in or right after the before\_destroy is called. What we do  
is we set the active field to 0 and return false which stops the  
destroy. But the problem is that the page needs to be refreshed for it  
to not show the inactive row.  
Thanks for the help

---

<div class="post-metadata">

**Author:** ![smithy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a4c791/32.png) [@smithy](https://www.ruby-forum.com/u/smithy)\
**Post date:** [August 21, 2007, 8:59am UTC](https://www.ruby-forum.com/t/force-refresh/112529/2 "2007-08-21T08:59:51Z")

</div>

Jack S. wrote:

> Hello,  
> Im new with Ruby on Rails and have a problem. I need to force a refresh  
> of the page in or right after the before\_destroy is called. What we do  
> is we set the active field to 0 and return false which stops the  
> destroy. But the problem is that the page needs to be refreshed for it  
> to not show the inactive row.  
> Thanks for the help

render some javascript to refresh the page in an (after\_destroy  
:method\_to\_refresh) call? something like

after\_destroy :method\_to\_refresh

# controller

protected

def method\_to\_refresh  
render :update |page| do  
page \<\< ‘window.location.reload()’  
end  
end

---

<div class="post-metadata">

**Author:** ![smithy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a4c791/32.png) [@smithy](https://www.ruby-forum.com/u/smithy)\
**Post date:** [August 21, 2007, 4:28pm UTC](https://www.ruby-forum.com/t/force-refresh/112529/3 "2007-08-21T16:28:21Z")

</div>

Shai R. wrote:

> Jack S. wrote:
> 
> > Hello,  
> > Im new with Ruby on Rails and have a problem. I need to force a refresh  
> > of the page in or right after the before\_destroy is called. What we do  
> > is we set the active field to 0 and return false which stops the  
> > destroy. But the problem is that the page needs to be refreshed for it  
> > to not show the inactive row.  
> > Thanks for the help
> 
> render some javascript to refresh the page in an (after\_destroy  
> :method\_to\_refresh) call? something like
> 
> after\_destroy :method\_to\_refresh
> 
> # controller
> 
> protected
> 
> def method\_to\_refresh  
> render :update |page| do  
> page \<\< ‘window.location.reload()’  
> end  
> end

Thanks for the info. As i said I am new so i hope you stay with me. I  
tried the code you suggested and i get this errror:

syntax error, expecting kCLASS kMODULE kDEF kBEGIN kIF kUNLESS kCASE  
kWHILE kUNTIL kFOR  
kBREAK kNEXT kREDO kRETRY kRETURN kYIELD kSUPER kSELF kNIL kTRUE kFALSE  
kDEFINED  
k\_\_LINE\_\_ k\_\_FILE\_\_ tIDENTIFIER tFID tGVAR tIVAR tCONSTANT tCVAR  
tNTH\_REF tBACK\_REF  
tINTEGER tFLOAT tUPLUS tUMINUS tUMINUS\_NUM tCOLON3 tLPAREN tLPAREN\_ARG  
tLBRACK  
tLBRACE tTILDE tBANG tSYMBEG tSTRING\_BEG tXSTRING\_BEG tREGEXP\_BEG  
tWORDS\_BEG  
tQWORDS\_BEG but found kDO\_BLOCK instead

which doesnt mean a thing to me. I tried to google it with no luck.

Thanks again
