From: Andrew Dangerfield Date: 2011-01-23T12:58:21+09:00 Subject: How to use image_tag method from module ActionView::Helpers::AssetTag? I am just getting started using ruby and rails and I have a simple class I am refactoring with rspec and am getting the error "NoMethodError: undefined method 'image_tag'" so I know I am doing something wrong with bringing in the module but I do not know what and hope someone can possibly give me some assistance. Here is the relevant code from the class: *********************************************************************** require 'rubygems' class Helper def self.foo "foo" end def show(profile, size, html = {}, options = {}, link = true) ... nonrelevant code ... return image_tag("default.png") end end *********************************************************************** I have tried adding "require 'action_view/helpers/asset_tag_helper'" to the top of the file containing the class and have tried putting "include ActionView::Helpers::AssetTagHelper" into the body of the class but have been unsuccessful so far. My main programming language is C/C++ where a simple "include" would usually do the trick in a situation like this so I am guessing that I just have not come across the documentation on the correct way to bring in such a module. Can anyone tell me what I am doing wrong, point me to a tutorial, or give me a short example of the right way to use that "image_tag" method? -- Posted via http://www.ruby-forum.com/.