I made a helper module and put it in the helper directory but when I try and access any methods it says it does not recognize them. Ideas? Rails 2.3.5 Helper: module XmlTestDataHelper def update_xml_data end end Controller: update_xml_data undefined local variable or method `update_xml_data'' -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sat, Apr 17, 2010 at 2:19 PM, Me <chabgood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I made a helper module and put it in the helper directory but when I > try and access any methods it says it does not recognize them. Ideas? > Rails 2.3.5 > > Helper: > > module XmlTestDataHelper > def update_xml_data > > end > > end > > > Controller: > > update_xml_data > > undefined local variable or method `update_xml_data'' >Are you requiring the file and including the module somewhere? -- Leonardo Mateo. There''s no place like ~ -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No, are not all of the helpers included all the time? I have ''helper :all'' in the application controller. On Apr 17, 12:41 pm, Leonardo Mateo <leonardoma...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Sat, Apr 17, 2010 at 2:19 PM, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > I made a helper module and put it in the helper directory but when I > > try and access any methods it says it does not recognize them. Ideas? > > Rails 2.3.5 > > > Helper: > > > module XmlTestDataHelper > > def update_xml_data > > > end > > > end > > > Controller: > > > update_xml_data > > > undefined local variable or method `update_xml_data'' > > Are you requiring the file and including the module somewhere? > > -- > Leonardo Mateo. > There''s no place like ~ > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
helper: all just makes all the helpers available to your views, but not to controller or model classes. This is because helpers are really meant for views only. You can mix a helper in by including the helper, but it really isn''t a good practice. Better to create a separate module or mixin and not have it be a helper. Sheldon Finlay On Apr 17, 5:13 pm, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> No, are not all of the helpers included all the time? I have > ''helper :all'' in the application controller. > > On Apr 17, 12:41 pm, Leonardo Mateo <leonardoma...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > On Sat, Apr 17, 2010 at 2:19 PM, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I made a helper module and put it in the helper directory but when I > > > try and access any methods it says it does not recognize them. Ideas? > > > Rails 2.3.5 > > > > Helper: > > > > module XmlTestDataHelper > > > def update_xml_data > > > > end > > > > end > > > > Controller: > > > > update_xml_data > > > > undefined local variable or method `update_xml_data'' > > > Are you requiring the file and including the module somewhere? > > > -- > > Leonardo Mateo. > > There''s no place like ~ > > > -- > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
okie dokie. On Sat, Apr 17, 2010 at 21:27, Sheldon Finlay <jagfly-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> helper: all just makes all the helpers available to your views, but > not to controller or model classes. This is because helpers are really > meant for views only. You can mix a helper in by including the helper, > but it really isn''t a good practice. Better to create a separate > module or mixin and not have it be a helper. > > Sheldon Finlay > > On Apr 17, 5:13 pm, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > No, are not all of the helpers included all the time? I have > > ''helper :all'' in the application controller. > > > > On Apr 17, 12:41 pm, Leonardo Mateo <leonardoma...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > On Sat, Apr 17, 2010 at 2:19 PM, Me <chabg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I made a helper module and put it in the helper directory but when I > > > > try and access any methods it says it does not recognize them. Ideas? > > > > Rails 2.3.5 > > > > > > Helper: > > > > > > module XmlTestDataHelper > > > > def update_xml_data > > > > > > end > > > > > > end > > > > > > Controller: > > > > > > update_xml_data > > > > > > undefined local variable or method `update_xml_data'' > > > > > Are you requiring the file and including the module somewhere? > > > > > -- > > > Leonardo Mateo. > > > There''s no place like ~ > > > > > -- > > > 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<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > > > For more options, visit this group athttp:// > groups.google.com/group/rubyonrails-talk?hl=en. > > > > -- > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > > For more options, visit this group athttp:// > groups.google.com/group/rubyonrails-talk?hl=en. > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.