不好意思,忘了这个方法了
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