Hi! I want to write custom helper, accessible for all views and I want to use other helpers like form_remote_tag. I tried first to move .rhtml template code and parse it with ERB: module ApplicationHelper def search_box str = %| <%= form_remote_tag(:url => {:controller => :search, :action => ''search''}, :update => ''search_results'') do %> blah blah <% end %> | return ERB.new(str).run end But I''ve got ActionView::TemplateError (undefined method `form_remote_tag'' for main:Object) after I''ve used search_box helper in my view. Adding include ActionView::Helpers::FormTagHelper to ERB string nor ApplicationHelper does not help. How I should use helpers in this case? -- Witold Rugowski http://nhw.pl/wp/ (EN blog) http://nhw.pl/pl/ (PL blog) -- 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 -~----------~----~----~----~------~----~------~--~---
I would probably use a partial for this as this doesn''t seem abstract enough to be a helper. Will you use this form differently in more than one place? To answer you''re exact question, I''m not sure that remote_form_tag is in FormTagHelper - it''s in PrototypeHelper. However, I would seriously consider using a partial as this helper could get real messy, real fast. If you really do need to use a helper, I''d suggest having a look at the source code for the tag helpers and see how it''s handled by Rails. Steve --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Stephen Bartholomew wrote:> I would probably use a partial for this as this doesn''t seem abstract > enough to be a helper. Will you use this form differently in more > than one place?Well maybe this time I can use partial, but I think using partials could also become messy (in my case), since with them I have to stick to variable names. In search form this will be no problem, but in others could be. Anyway, now I wonder how to use Rails helpers in custom helper ;))> > To answer you''re exact question, I''m not sure that remote_form_tag is > in FormTagHelper - it''s in PrototypeHelper. However, I would > seriously consider using a partial as this helper could get real > messy, real fast.Yes, exactly ProtypeHelper. I have tested with this include ;-) -- Witold Rugowski http://nhw.pl/wp/ (EN blog) http://nhw.pl/pl/ (PL blog) -- 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 -~----------~----~----~----~------~----~------~--~---