老贴新问
今天翻看了下以前大家发的贴子,有个贴子中有这么个方法
def display(elements, params)
# elements is an array of element ids, usually divs
render(:update) { |page|
@params = params
# If a view calls a helper, it looses access to the params of this block
# However it continues to have access to this block's instance variables
if elements.include?("items")
page.replace_html "items", :partial =>"items/items"
end
if elements.include?("function")
function = params[:function] ? params[:function] : "Callback"
page.call(function, params)
end
}
end
这个方法中对于render(:update)以及后面的page都不明白是什么,希望作者看到能解释下 谢谢