Rails: Accessing /lib Modules from Controller

Posted by Dex on Stack Overflow See other posts from Stack Overflow or by Dex
Published on 2010-06-06T08:57:39Z Indexed on 2010/06/06 9:02 UTC
Read the original article Hit count: 367

Filed under:
|
|

I have a Module called /lib/string_parser.rb. It looks like:

module StringParser
  def wrap_lines(input, chars)
    ...
  end
  #make available to views
  def self.included(base)
    base.send :helper_method, :my_method_for_views if base.respond_to? :helper_method
  end
end

I'm trying to call wrap_lines from the create method of my controller but no matter what I do, I keep getting NoMethodErrors for an undefined method.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about module