Problem with client-side RJS using update_page

I tried to use RJS inside my rhtml template like this:

<%= select_tag “price”, … %>
<%= observe_field :price, :function => update_page do |page|

page.insert_html :after, ‘price’, “3”
end %>

But when I refresh the browser, I get the following error from the rthml
engine:
You have a nil object when you didn’t expect it! The error occurred
while evaluating nil.bind

How come?

Hmm, so it appears if I add brackets to the options hash for
update_page, it
would work:
<%= select_tag “price”, … %>
<%= observe_field :price, { :function => update_page do |page|

page.insert_html :after, ‘price’, “3”
end }
%>

I’m aware of the need for explicit hash when it’s not the last argument,
but
why is bracket required in this case?

On 8 Nov 2007, at 23:20, Eric L. wrote:

I’m aware of the need for explicit hash when it’s not the last
argument, but why is bracket required in this case?

I expect it thought that you meant

observe_field(:price, :function => update_page) do |page|
page.insert_html :after, ‘price’, “3”
end

Fred