Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

rendering rjs partial breaks response content type

#4025

I trying to render _some_partial.rjs in action template (index.html.haml (or .erb)), after that I see html content in browser like simple text, becouse response conteins header: Content-Type: text/javascript; charset=utf-8

Rails 3.0.0.beta1
ruby 1.9.2dev

Reported by Alexander Stanko · February 21st, 2010 @ 07:09 PM

State: invalid
Milestone: 3.0.2
Assigned to: José Valim José Valim
Importance: High

Activity

  1. José Valim
    José Valim

    Could you please provide a failing test case?

    February 21st, 2010 @ 07:32 PM

  2. José Valim
    José Valim
    • Assigned user set to Yehuda Katz (wycats)

    February 21st, 2010 @ 07:36 PM

  3. Alexander Stanko
  4. Alexander Stanko
    Alexander Stanko
    • Tag changed from rjs to rails3, rjs

    February 22nd, 2010 @ 12:19 PM

  5. José Valim
    José Valim
    • Assigned user changed from Yehuda Katz (wycats) to José Valim

    February 23rd, 2010 @ 09:18 PM

  6. José Valim
    José Valim
    • State changed from new to open

    Hey Alexander, thanks for the patch!

    I'm looking for a solution, meanwhile, do you mind creating a new patch using git format-patch? This way you will have the commit authorship.

    February 26th, 2010 @ 11:19 AM

  7. Alexander Stanko
  8. José Valim
    José Valim
    • Milestone cleared.

    Handing it back to Yehuda.

    February 26th, 2010 @ 06:23 PM

  9. José Valim
    José Valim
    • Assigned user changed from José Valim to Yehuda Katz (wycats)

    February 27th, 2010 @ 08:17 AM

  10. José Valim
    José Valim
    • State changed from open to invalid
    • Assigned user changed from Yehuda Katz (wycats) to José Valim

    After discussing with Yehuda once again and other people, we came to the fact we don't want to support this scenario explicitly. If you need to render another formats (like js) from a template, you will need to explicitly tell the lookup context object (which holds all information used on lookup) that it should consider this new format. In your case, you should try something like this:

    update_details(:formats => [:js]){ render "rjs_template" }
    

    Please let me know if it works as expected!

    June 7th, 2010 @ 11:27 PM

  11. Falk Pauser
    Falk Pauser
    • Importance changed from to High

    I just needed this too - and it works as expected:

    <%= update_details(:formats => [:js]) { render 'shared/specific-js-template' } %>

    August 31st, 2010 @ 02:34 PM

  12. Ryan Bigg
    Ryan Bigg
    • Tag cleared.

    Automatic cleanup of spam.

    October 11th, 2010 @ 12:10 PM

  13. Jeremy Kemper