3
votes

I have a rails app which shows the following log for a single action

Completed in 587ms (View: 415, DB: 29) | 200 OK [http://localhost/]

its taking 415 ms to render the view layer. Is there any way to optimize view rendering in rails ? I am a beginner in ruby on rails.

I have render call like this on a page(written in HAML) that showed me the above log time. I want to optimize the rendering of these partials

  - auctions.each do |auction|
    = render :partial => "/shared/vertical_item", :object => auction,:inline => true  

thanks

2

2 Answers

0
votes

A very nice way to optimize views is by using Fragment and Page Caching. But be careful about overdoing it.

0
votes

I could be confused, but i do not know what the :inline => true is supposed to do. According to me :inline is used to render inline erb without using a template, e.g.

  render :inline => "<%= 'hello ' + name %>", :locals => { :name => "david" }

(from the documentation)

So i would suggest to remove that :inline => true and see if that helps.

Otherwise i would like to see that partial you are using.