Hey, I am wondering if moving forward we would like to have to_partial_path be
implemented something like:
def _to_partial_path(view = nil) #:nodoc:
begin
element = if view.nil?
ActiveSupport::Inflector.underscore(ActiveSupport::Inflector.demodulize(name))
else
String(view)
end
collection = ActiveSupport::Inflector.tableize(name)
"#{collection}/#{element}"
end
end
Over the old method. The main benefit is rendering partials of polymorphic
types.
For example:
In the display ImageController#show
= render @imaginable.to_partial_path(:show)
In the display ImageController#edit
= render @imaginable.to_partial_path(:edit)
If you guys have a better solution. I'd like to hear it.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to rubyonrails-core+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.