Maybe this one is just way too esoteric to matter all that much, but it''s bugging me. I''m doing a prototype for demonstration on Thursday, and making heavy use of components (scalability/performance not a concern, but rapid development of small contained pieces is). Here''s my problem - it looks like a text_field_with_auto_complete doesn''t work in a component, because of the changing controller. I''ve got main/index.rhtml, from which I render component/index.rhtml. In component/index.rhtml I have a text_field_with_auto_complete :person, :name When it runs, however, I get an error because Rails looks for the auto_complete_for_person_name method on the *main* controller, rather than the *component* controller. I mean, I can see why it does that, I''m just trying to figure out a way around it. Best I can tell there''s no :controller=>"component" option I can slap on the text field. The strange thing is that if I do an Ajax update on the component/index.rhtml page (sort of "portlet" style where just the div updates), then the text_field_with_auto_complete works fine. So something about the Ajax update changes the context under which the text field is rendering, so that it knows it is now in the component/ controller instead of main/. Anybody got any suggestions? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 Wed, May 21, 2008 at 4:42 AM, Duane Morin <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Maybe this one is just way too esoteric to matter all that much, but > it''s bugging me. I''m doing a prototype for demonstration on Thursday, > and making heavy use of components (scalability/performance not a > concern, but rapid development of small contained pieces is). Here''s > my problem - it looks like a text_field_with_auto_complete doesn''t work > in a component, because of the changing controller.Pass :url in the rightmost options parameter: def text_field_with_auto_complete(object, method, tag_options = {}, completion_options = {}) like this: <%= text_field_with_auto_complete :user, :name, {}, :url => { ... } %> That''s a regular :url option, you may assign a named route as well for example. -- fxn --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---