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".

15 Responses to “Rails 2 and broken render_text”

  1. vince Says:

    Thanks, just what I was looking for!

  2. Anderson Says:


  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

  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?

  6. jackphelps Says:

    thanks! very helpful. man, these other people seem to think technology is ever going to be perfect.

  7. Frank Says:

    Thanks, say Frank!

  8. Tom Says:

    Thanks for your help, useful hint.

  9. Congstar Says:

    Thanks for your help. It made my day :)

  10. roger Says:

    yeah google brought me right here :)
    Guess it was deprecated.

  11. Eric Says:

    You saved me a ton of time by posting this information. Thank you!

  12. Workshop 2 « Itc565blogger Says:

    [...] doesn’t work in Ruby 1.9. You need to use: [...]

  13. Matze Says:

    Thanks so much. Just what I was looking for. Now I can continue developing :-)

  14. demotivator Says:

    This was great. I was looking for problems in my installation of ruby instead of backwards compatibility.

  15. iambalu Says:

    i getting trouble with “render_text”, in the mean while u helped me alot..
    Thank You dear..
    Keep go on.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

%d bloggers like this: