Hey guys,

I'm doing some work on partials and am trying to figure out what the 
usage of the variables that are currently assigned is.

Consider a case where you have a partial named _user.html.erb. In Rails 
2.3, the following variables are assigned:

    * user
    * options[:as] if options[:as] exists
    * object

My question is whether these are all used at the same time. Reducing the 
number of variables assigned makes a performance difference that is 
particularly noticable in large collections. There are some things that 
I'm thinking about, but I want to hear what the normal usage is. Feel 
free to tell me this is crazy and people use all three all the time. 
Some options:

    * set options[:as] to default to :object. If options[:as] is
      specified, the `object` local would not be set.
    * set options[:as] to default to the partial name. If options[:as]
      is specified, the partial name would not be set. In this case,
      `object` would always be set separately.
    * a more radical option would be to deprecate the usage of `object`
      and default options[:as] to the partial name. This would guarantee
      that only a single known name would need to be set each iteration.
      I am told, however, that `object` is actually in use.

Are either of these options palatable? Effectively, the question is 
whether `object`, the name of the partial, and a separate options[:as] 
are used all at the same time in the same partial.

Thoughts?

-- Yehuda

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

Reply via email to