#9 ✓stale
Rene Madsen

undefined local variable or method `include_tiny_mce_if_needed'

Reported by Rene Madsen | August 18th, 2009 @ 11:36 PM

Hi, I'm have a project, where I have this line included in application.html.haml as described on http://github.com/kete/tiny_mce/tree/master step 3.

It all works fine in development, but in test and production it does not work. I get this error:

ActionView::TemplateError (undefined local variable or method `include_tiny_mce_if_needed' for #<ActionView::Base:0x7fbb18ea12a0>) on line \#8 of app/views/layouts/application.html.haml:

Any suggestions to, what to try.

Comments and changes to this ticket

  • Rene Madsen

    Rene Madsen August 19th, 2009 @ 01:55 AM

    I have the following plugins:

    And the following gems installed:

    actionmailer (2.3.3, 2.3.2)
    actionpack (2.3.3, 2.3.2)
    activemerchant (1.4.2)
    activerecord (2.3.3, 2.3.2)
    activerecord-tableless (0.1.0)
    activeresource (2.3.3, 2.3.2)
    activesupport (2.3.3, 2.3.2)
    aslakhellesoy-cucumber (0.3.94)
    authlogic (2.1.1)
    builder (2.1.2)
    calendar_date_select (1.15)
    capistrano (2.5.8)
    capistrano-ext (1.2.1)
    chriseppstein-compass (0.6.15)
    cucumber (0.3.90)
    diff-lcs (1.1.2)
    expectations (1.2.1)
    haml (2.2.2)
    haml-edge (2.1.37)
    highline (1.5.1)
    linecache (0.43)
    mislav-will_paginate (2.3.11)
    mocha (0.9.7)
    mysql (2.7)
    net-scp (1.0.2)
    net-sftp (2.0.2)
    net-ssh (2.0.11)
    net-ssh-gateway (1.0.1)
    nokogiri (1.3.2)
    polyglot (0.2.6)
    rack (1.0.0)
    rails (2.3.3, 2.3.2)
    rake (0.8.7)
    rcov (
    rsl-stringex (1.0.0)
    rspec (1.2.8)
    rspec-rails (
    ruby-debug-base (0.10.3)
    ruby-debug-ide (0.4.6)
    searchlogic (2.1.13)
    sqlite3-ruby (1.2.5)
    term-ansicolor (1.0.4)
    thoughtbot-factory_girl (1.2.2)
    thoughtbot-shoulda (2.10.2)
    tlsmail (0.0.1)
    treetop (1.3.0)
    webrat (0.4.4)
    ZenTest (4.0.0)

  • Kieran P

    Kieran P August 19th, 2009 @ 05:43 PM

    • State changed from “new” to “open”
    • Tag set to error, helpers

    Hmm, I am unable to get the same issue you are describing. We've been using TinyMCE in development, production, and test without issue for some time.

    Can you start a new Rails app, and get the problem to occur with as little code as possible please. Then zip it and attach here. I'll try it on my end. If I'm lucky, it'll get the error (something I can debug). If I don't, them it might be something in your ruby environment.

  • ronin-71764 (at lighthouseapp)

    ronin-71764 (at lighthouseapp) October 2nd, 2009 @ 09:18 PM

    after doing exactly what is mentioned in the install howto, I get an error that is different but I think has to do with the same issue:

    undefined method `development?' for "development":String

    this happens when i add the line

    <%= include_tiny_mce_if_needed %>

    i figured out that it might have to do with <%= javascript_include_tag :all %> and I noticed that when I restart my server, a tinymce folder is created in public/javascripts, which is not loaded in my head tag when i drop the if_needed line in favor of include :all.

    Hope that helps,

  • Kieran P

    Kieran P October 2nd, 2009 @ 10:16 PM

    In the tiny_mce_helpers.rb file (or similarly named file depending on what version of the plugin/gem you've got installed), replace



    Rails.env == 'development'

    I believe the error you're getting is because you're using a Rails version prior to 2.3?

    If the above change works for you, I'll make a commit to fix this in the next release.

  • ronin-71764 (at lighthouseapp)

    ronin-71764 (at lighthouseapp) October 3rd, 2009 @ 03:15 AM

    thanks kieran - this works perfectly. and you are right - this was rails 2.1.0-4 (ubuntu), but with this modification, it works out nicely ;)

  • Kieran P

    Kieran P January 6th, 2010 @ 01:32 PM

    • State changed from “open” to “resolved”
  • jan.jones (at gmail)

    jan.jones (at gmail) March 20th, 2010 @ 12:49 AM

    I have this problem, any clues?

    I am using 2.3.5, all works fine in dev but in staging/prod it gives the error. I am using 0.1.1.


  • Kieran P

    Kieran P March 20th, 2010 @ 08:54 PM

    • State changed from “resolved” to “open”

    Hey jan.jones. As my first comment pointed out, I'm unable to reproduce this issue. Can you try the fix a few comments up. If that works, I'll push out a new tiny mce gem release with it soon.

  • Kieran P

    Kieran P March 25th, 2010 @ 10:08 PM

    • State changed from “open” to “stale”

    There is a brand new release (0.1.2). Please post back if this release hasn't fixed the issue you were getting.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

A Ruby on Rails plugin that allows easy implementation of the TinyMCE editor into your applications.

People watching this ticket