checking for elements before replace_html on it

I do a whole lot of this from my controllers:

render :update do |page|      page.replace_html 'someUniqueID', "Some content" end

For one reason or another, sometimes this code is delayed and by the time it executes "someUniqueID" is no longer on the page. I need to work an if statement in somewhere to verify that 'someUniqueID' is still present on the page before the replace_html gets fired off.

I've tried:

if page['someUniqueID'] Always returns true, even if someUniqueID is present

page.select('#someUniqueID').first.replace_html 'someContent' With this, somehow "replace_html" gets converted to "replaceHTML" and then spits off:     "replaceHtml is not a function"

Any other ideas??

Thanks!