Rails 2 and broken render_text

Looks like that in Rails 2, in addition to changing the default database, default sessions store, now some of the oldies such as render_text method no longer work as expected. If you’ve used render_text "some text" in a controller, then you’ll need to replace it with render :text => "some text".

5 Responses to “Rails 2 and broken render_text”

  1. vince Says:

    Thanks, just what I was looking for!

  2. Anderson Says:

    Thanks…

  3. Jill Says:

    Thanks. I love Google. And now I love you.

  4. Lenny Says:

    I haven’t moved up to Rails 2 yet, because of the many incompatibilities I keep reading about. In fact, I kinda suspect that Rails 2 may well kill Rails because folks like me won’t move up to v2 and will instead move on to other technologies for our next projects.

    Meanwhile, though, for those who’ve been suckered into upgrading existing projects that use render_text to Rails 2, it should be possible to re-created it with the following at the end of config/environment.rb (untested, as I don’t run Rails 2):

    class ActionController::Base # :nodoc
    def render_text(text = nil, status = 200, append_response = false) #:nodoc:
    render :text => text, :status => status, :append_response => append_response
    end
    end

  5. neurodancer Says:

    So much for backward compatibility! Can we stop changing things? this kind of migration has caused me more than one headache with rails and ruby!!!! If ruby and rails are so “great”, why this stupidity?

Leave a Reply