I use ruby on reiki 3. I have a model called Content. Inside the controller, I extract some variables and pass them to the viewer. In the viewer, I would like to use my own functions so that I don't have too much logic and code in the viewer. I defined these functions in the module ContentsHelper.
My functions defined in the ContentsHelper module use the auxiliary functions of the ActionViewer, however they are not available in the ContentHelper module. I get, for example, an error NoMethodError: undefined method content_tag' for #<Content:0x1025b9458>.
How can I make all the auxiliary functions of ActionViewer available?
Newbie.
after Tim’s suggestion:
module ContentsHelper
include ActionView::Helpers
def bla
content_tag(:h2, self.title)
end
I can run the bla method as Content.blain the console. It's fine!
content_tag image_tag, :
NoMethodError: undefined method `config'
from /Users/sonat/.rvm/gems/ruby-1.8.7-p334/gems/activemodel-3.0.0/lib/active_model/attribute_methods.rb:364:in `method_missing'
from /Users/sonat/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-3.0.0/lib/active_record/attribute_methods.rb:46:in `method_missing'
from /Users/sonat/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-3.0.0/lib/active_record/attribute_methods.rb:44:in `send'
, , image_tag, "-". , , , .