2010-05-31 8 views

Répondre

15

La solution de @Peter a fonctionné pour moi. Voici un exemple de code:

Vue:
<%= link_to 'download this page', object_path(@object, :download => true) %>

Controller:

def show 
    # ... 
    if params[:download] 
    send_data(render_to_string, :filename => "object.html", :type => "text/html") 
    else 
    # render normally 
    end 
end 
Questions connexes