Rails: NoMethodError only

I am on the 12th hour of programming, so I might have missed something simple, but any suggestions on this issue?

in my app_helper i added a module for redcarpet filter with haml

module Haml::Filters::Redcarpet include Haml::Filters::Base include ActionView::Helpers::TagHelper def render(text) options = [:autolink, :smart, :hard_wrap, :no_intraemphasis] content_tag(:div, Redcarpet.new(text.to_s, *options).to_html.html_safe, :class => "markup" ) end end 

works great in development. but in production he throws

 [ !EXCEPTION! ] NoMethodError: undefined method 'content_tag' for Haml::Filters::Redcarpet:Module 

why was that? or what can i check? I even ran the console in production and was able to turn on TagHelper and use these methods. puzzled ...

+4
source share
1 answer

I assume that you have different versions of one or more gems in your production box from your dev environment. Make a β€œgem list” in both and add the results to the original message.

The best way to avoid this problem is to use the Ruby Version Manager (RVM) and the gem β€œbundler”: you can create a gemset specific to your project, and thus make sure that the gems are the same for both versions (prod and dev) of the project .

rvm: https://rvm.io

bundler: http://gembundler.com/

Oh - and if you look down at your stack trace, you will probably see a link to the gem that sets the haml / redcarpet material, it is probably a criminal, that is, it has a different version.

+1
source

All Articles