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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jack Smith 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 like after_destroy :method_to_refresh # controller protected def method_to_refresh render :update |page| do page << ''window.location.reload()'' end end -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Shai Rosenfeld wrote:> Jack Smith 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 > endThanks 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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---