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
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
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 helprender some javascript to refresh the page in an (after_destroy
:method_to_refresh) call? something likeafter_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