The following are the code snippets of the situation. Its about the rjs.
The returned html via /order/new is as follows:
PhoneFirst NameLast Name
When this remote form is submitted, the 'create' method of the OrdersController is fired and the code which tries to update the div with the id #flash_messages of the main layout is as follows:..... render :update do |page| page.replace "flash_messages", "Error checking out. Re-order again!!" end ......
And the RJS error is "RJS error, TypeError: element is null". And its because of the call:page.replace "flash_messages"
Since, theis still in the main-layout of the index page, why can't the "page.replace" get that element? If I put the in the updated html sent via "/order/new" action, the page.replace "flash_messages" works. But if I got to do that, then it won't be dry coz I got to put it in every Ajax.Updater call?? So, how could I access the #flash_messages of the main-layout to make it dry?