views:

57

answers:

2

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

A: 

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

Rishav Rastogi
my problem is with rendering parials.. let me update my question to explain the situation
lakshmanan
try switching on the ugly mode in haml
Rishav Rastogi
A: 

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.

nathanvda