Ruby on Rails Thursday, October 28, 2010

In Rails 2 I could do this to get the view as a string (i.e. to save it to a file):

    av = ActionView::Base.new(Rails::Configuration.new.view_path)
    html = av.render(
        :partial => "comparisons/display",
        :locals => { :comparison => self, :format_html => nil, :print_view => print_view, :fully_qualified_url_prefix => fully_qualified_url_prefix, :user => user }
    )

In Rails 3 it seemingly does not work anymore. In reference to https://rails.lighthouseapp.com/projects/8994/tickets/3471-actionviewassigns-lost-its-usefulness, Yehuda Katz's comment (in reference to passing necessary parameters to ActionView::Base.new)  is "This was modified in order to improve performance and reduce the number of instance variable assigns we need to do in cases with many renders inside a single view."

So... is there a way to do this anyone knows of in Rails 3? Even if I can do so inside a controller I guess that would also be ok (I will try this next), but would prefer to leave things as they are.

Thanks,

David


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment