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? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 11/8/07, Eric Lin <eylinlist-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > 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? >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 8 Nov 2007, at 23:20, Eric Lin wrote:> 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? > >I expect it thought that you meant> observe_field(:price, :function => update_page) do |page| > page.insert_html :after, ''price'', "3" > endFred --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---