Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #10932 (closed enhancement: fixed)

Opened 5 months ago

Last modified 5 months ago

[PATCH] Use File.join to construct path for partial

Reported by: patrick.t.joyce Assigned to: core
Priority: normal Milestone: 2.x
Component: ActiveRecord Version: edge
Severity: minor Keywords: tiny
Cc:

Description

Currently the path for partials is constructed using string interpolation as follows:

"#{path}/_#{partial_name}"

This patch makes a change to use File.join to construct the path:

File.join(path, "_#{partial_name}")

This patch also has the side effect of allowing partials to again be stored directly in app/views (app/views/_partial.erb) and call them with render :partial => '/partial'

This is poor style, but did work in previous versions.

Partials should always go in a subdirectory of app/views If you have common partials stored directly in app/views you should move them to a subdirectory such as app/views/shared (app/views/shared/_partial.erb) and render them with render :partial => 'shared/partial'

Attachments

use_file_join_to_construct_partial_path.diff (1.4 kB) - added by patrick.t.joyce on 01/26/08 22:55:20.

Change History

01/26/08 22:55:20 changed by patrick.t.joyce

  • attachment use_file_join_to_construct_partial_path.diff added.

01/26/08 23:51:29 changed by patrick.t.joyce

  • type changed from defect to enhancement.

01/27/08 01:03:59 changed by nzkoz

  • status changed from new to closed.
  • resolution set to fixed.

(In [8739]) Use File.join to construct partial path. Closes #10932 [patrick.t.joyce]