public
Fork of rails/rails
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/technoweenie/rails.git
Search Repo:
Deprecate :use_full_path render option. The supplying the option no longer 
has an effect.
josh (author)
Wed Jul 02 19:38:58 -0700 2008
commit  3b3790a4351ba7c9d2711089c21f24fcedc11fc0
tree    5b51c79d8493bcbc42879933af1d3bbb8084f014
parent  6c0edef26ee1c0e5f0964cae64c9f48da6daf1fa
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 *Edge*
0
 
0
+* Deprecate :use_full_path render option. The supplying the option no longer has an effect [Josh Peek]
0
+
0
 * Add :as option to render a collection of partials with a custom local variable name. #509 [Simon Jefford, Pratik Naik]
0
 
0
   render :partial => 'other_people', :collection => @people, :as => :person
...
858
859
860
861
 
862
863
864
...
870
871
872
873
 
874
875
 
876
877
878
...
1097
1098
1099
1100
 
1101
1102
1103
 
1104
1105
1106
...
858
859
860
 
861
862
863
864
...
870
871
872
 
873
874
 
875
876
877
878
...
1097
1098
1099
 
1100
1101
1102
 
1103
1104
1105
1106
0
@@ -858,7 +858,7 @@ module ActionController #:nodoc:
0
 
0
         else
0
           if file = options[:file]
0
- render_for_file(file, options[:status], options[:use_full_path], options[:locals] || {})
0
+ render_for_file(file, options[:status], nil, options[:locals] || {})
0
 
0
           elsif template = options[:template]
0
             render_for_file(template, options[:status], true, options[:locals] || {})
0
@@ -870,9 +870,9 @@ module ActionController #:nodoc:
0
           elsif action_name = options[:action]
0
             template = default_template_name(action_name.to_s)
0
             if options[:layout] && !template_exempt_from_layout?(template)
0
- render_with_a_layout(:file => template, :status => options[:status], :use_full_path => true, :layout => true)
0
+ render_with_a_layout(:file => template, :status => options[:status], :layout => true)
0
             else
0
- render_with_no_layout(:file => template, :status => options[:status], :use_full_path => true)
0
+ render_with_no_layout(:file => template, :status => options[:status])
0
             end
0
 
0
           elsif xml = options[:xml]
0
@@ -1097,10 +1097,10 @@ module ActionController #:nodoc:
0
 
0
 
0
     private
0
- def render_for_file(template_path, status = nil, use_full_path = false, locals = {}) #:nodoc:
0
+ def render_for_file(template_path, status = nil, use_full_path = nil, locals = {}) #:nodoc:
0
         add_variables_to_assigns
0
         logger.info("Rendering #{template_path}" + (status ? " (#{status})" : '')) if logger
0
- render_for_text(@template.render(:file => template_path, :use_full_path => use_full_path, :locals => locals), status)
0
+ render_for_text(@template.render(:file => template_path, :locals => locals), status)
0
       end
0
 
0
       def render_for_text(text = nil, status = nil, append_response = false) #:nodoc:
...
232
233
234
235
 
236
237
238
239
240
 
241
242
243
...
250
251
252
253
 
254
255
256
...
298
299
300
301
302
 
303
304
 
305
306
307
...
232
233
234
 
235
236
237
238
 
 
239
240
241
242
...
249
250
251
 
252
253
254
255
...
297
298
299
 
 
300
301
 
302
303
304
305
0
@@ -232,12 +232,11 @@ module ActionView #:nodoc:
0
     # The hash in <tt>local_assigns</tt> is made available as local variables.
0
     def render(options = {}, local_assigns = {}, &block) #:nodoc:
0
       if options.is_a?(String)
0
- render_file(options, true, local_assigns)
0
+ render_file(options, nil, local_assigns)
0
       elsif options == :update
0
         update_page(&block)
0
       elsif options.is_a?(Hash)
0
- use_full_path = options[:use_full_path]
0
- options = options.reverse_merge(:locals => {}, :use_full_path => true)
0
+ options = options.reverse_merge(:locals => {})
0
 
0
         if partial_layout = options.delete(:layout)
0
           if block_given?
0
@@ -250,7 +249,7 @@ module ActionView #:nodoc:
0
             end
0
           end
0
         elsif options[:file]
0
- render_file(options[:file], use_full_path || false, options[:locals])
0
+ render_file(options[:file], nil, options[:locals])
0
         elsif options[:partial] && options[:collection]
0
           render_partial_collection(options[:partial], options[:collection], options[:spacer_template], options[:locals], options[:as])
0
         elsif options[:partial]
0
@@ -298,10 +297,9 @@ module ActionView #:nodoc:
0
     end
0
 
0
     private
0
- # Renders the template present at <tt>template_path</tt>. If <tt>use_full_path</tt> is set to true,
0
- # it's relative to the view_paths array, otherwise it's absolute. The hash in <tt>local_assigns</tt>
0
+ # Renders the template present at <tt>template_path</tt>. The hash in <tt>local_assigns</tt>
0
       # is made available as local variables.
0
- def render_file(template_path, use_full_path = true, local_assigns = {}) #:nodoc:
0
+ def render_file(template_path, use_full_path = nil, local_assigns = {}) #:nodoc:
0
         if defined?(ActionMailer) && defined?(ActionMailer::Base) && controller.is_a?(ActionMailer::Base) && !template_path.include?("/")
0
           raise ActionViewError, <<-END_ERROR
0
   Due to changes in ActionMailer, you need to provide the mailer_name along with the template name.
...
6
7
8
9
 
10
11
12
...
6
7
8
 
9
10
11
12
0
@@ -6,7 +6,7 @@ module ActionView #:nodoc:
0
       @view_controller = view.controller if view.respond_to?(:controller)
0
       @as = as
0
       set_path_and_variable_name!(partial_path)
0
- super(view, @path, true, locals)
0
+ super(view, @path, nil, locals)
0
       add_object_to_local_assigns!(object)
0
 
0
       # This is needed here in order to compile template with knowledge of 'counter'
...
5
6
7
8
 
 
 
 
 
9
10
11
12
13
 
14
15
16
 
17
18
19
...
63
64
65
66
 
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
 
 
 
 
82
83
84
 
 
 
 
 
 
 
 
 
85
86
87
...
5
6
7
 
8
9
10
11
12
13
14
15
16
 
17
18
19
 
20
21
22
23
...
67
68
69
 
70
71
72
 
 
 
 
 
 
 
 
 
 
 
 
 
73
74
75
76
77
78
 
79
80
81
82
83
84
85
86
87
88
89
90
0
@@ -5,15 +5,19 @@ module ActionView #:nodoc:
0
     attr_accessor :locals
0
     attr_reader :handler, :path, :extension, :filename, :method
0
 
0
- def initialize(view, path, use_full_path, locals = {})
0
+ def initialize(view, path, use_full_path = nil, locals = {})
0
+ unless use_full_path == nil
0
+ ActiveSupport::Deprecation.warn("use_full_path option has been deprecated and has no affect.", caller)
0
+ end
0
+
0
       @view = view
0
       @paths = view.view_paths
0
 
0
       @original_path = path
0
- @path = TemplateFile.from_path(path, !use_full_path)
0
+ @path = TemplateFile.from_path(path)
0
       @view.first_render ||= @path.to_s
0
       @source = nil # Don't read the source until we know that it is required
0
- set_extension_and_file_name(use_full_path)
0
+ set_extension_and_file_name
0
 
0
       @locals = locals || {}
0
       @handler = self.class.handler_class_for_extension(@extension).new(@view)
0
@@ -63,25 +67,24 @@ module ActionView #:nodoc:
0
     end
0
 
0
     private
0
- def set_extension_and_file_name(use_full_path)
0
+ def set_extension_and_file_name
0
         @extension = @path.extension
0
 
0
- if use_full_path
0
- unless @extension
0
- @path = @view.send(:template_file_from_name, @path)
0
- raise_missing_template_exception unless @path
0
- @extension = @path.extension
0
- end
0
-
0
- if @path = @paths.find_template_file_for_path(path)
0
- @filename = @path.full_path
0
- @extension = @path.extension
0
- end
0
- else
0
- @filename = @path.full_path
0
+ unless @extension
0
+ @path = @view.send(:template_file_from_name, @path)
0
+ raise_missing_template_exception unless @path
0
+ @extension = @path.extension
0
         end
0
 
0
- raise_missing_template_exception if @filename.blank?
0
+ if p = @paths.find_template_file_for_path(path)
0
+ @path = p
0
+ @filename = @path.full_path
0
+ @extension = @path.extension
0
+ raise_missing_template_exception if @filename.blank?
0
+ else
0
+ @filename = @original_path
0
+ raise_missing_template_exception unless File.exist?(@filename)
0
+ end
0
       end
0
 
0
       def raise_missing_template_exception
...
4
5
6
7
8
 
 
9
10
11
...
17
18
19
20
 
21
22
23
24
 
 
25
26
27
...
4
5
6
 
 
7
8
9
10
11
...
17
18
19
 
20
21
22
 
 
23
24
25
26
27
0
@@ -4,8 +4,8 @@ module ActionView #:nodoc:
0
   # from the load path root e.g. "hello/index.html.erb" not
0
   # "app/views/hello/index.html.erb"
0
   class TemplateFile
0
- def self.from_path(path, use_full_path = false)
0
- path.is_a?(self) ? path : new(path, use_full_path)
0
+ def self.from_path(path)
0
+ path.is_a?(self) ? path : new(path)
0
     end
0
 
0
     def self.from_full_path(load_path, full_path)
0
@@ -17,11 +17,11 @@ module ActionView #:nodoc:
0
     attr_accessor :load_path, :base_path, :name, :format, :extension
0
     delegate :to_s, :inspect, :to => :path
0
 
0
- def initialize(path, use_full_path = false)
0
+ def initialize(path)
0
       path = path.dup
0
 
0
- # Clear the forward slash in the beginning unless using full path
0
- trim_forward_slash!(path) unless use_full_path
0
+ # Clear the forward slash in the beginning
0
+ trim_forward_slash!(path)
0
 
0
       @base_path, @name, @format, @extension = split(path)
0
     end
...
81
82
83
84
 
85
86
87
88
89
 
90
91
92
...
231
232
233
234
 
235
236
237
238
239
240
 
241
242
243
...
81
82
83
 
84
85
86
87
88
 
89
90
91
92
...
231
232
233
 
234
235
236
237
238
239
 
240
241
242
243
0
@@ -81,12 +81,12 @@ class NewRenderTestController < ActionController::Base
0
 
0
   def render_file_not_using_full_path
0
     @secret = 'in the sauce'
0
- render :file => 'test/render_file_with_ivar', :use_full_path => true
0
+ render :file => 'test/render_file_with_ivar'
0
   end
0
 
0
   def render_file_not_using_full_path_with_dot_in_path
0
     @secret = 'in the sauce'
0
- render :file => 'test/dot.directory/render_file_with_ivar', :use_full_path => true
0
+ render :file => 'test/dot.directory/render_file_with_ivar'
0
   end
0
 
0
   def render_xml_hello
0
@@ -231,13 +231,13 @@ class NewRenderTestController < ActionController::Base
0
   end
0
 
0
   def render_to_string_with_exception
0
- render_to_string :file => "exception that will not be caught - this will certainly not work", :use_full_path => true
0
+ render_to_string :file => "exception that will not be caught - this will certainly not work"
0
   end
0
 
0
   def render_to_string_with_caught_exception
0
     @before = "i'm before the render"
0
     begin
0
- render_to_string :file => "exception that will be caught- hope my future instance vars still work!", :use_full_path => true
0
+ render_to_string :file => "exception that will be caught- hope my future instance vars still work!"
0
     rescue
0
     end
0
     @after = "i'm after the render"
...
12
13
14
15
 
16
17
18
...
21
22
23
24
 
25
26
27
...
12
13
14
 
15
16
17
18
...
21
22
23
 
24
25
26
27
0
@@ -12,7 +12,7 @@ class ViewRenderTest < Test::Unit::TestCase
0
   end
0
 
0
   def test_render_file_not_using_full_path
0
- assert_equal "Hello world!", @view.render(:file => "test/hello_world.erb", :use_full_path => true)
0
+ assert_equal "Hello world!", @view.render(:file => "test/hello_world.erb")
0
   end
0
 
0
   def test_render_file_without_specific_extension
0
@@ -21,7 +21,7 @@ class ViewRenderTest < Test::Unit::TestCase
0
 
0
   def test_render_file_with_full_path
0
     template_path = File.join(File.dirname(__FILE__), '../fixtures/test/hello_world.erb')
0
- assert_equal "Hello world!", @view.render(:file => template_path, :use_full_path => false)
0
+ assert_equal "Hello world!", @view.render(:file => template_path)
0
   end
0
 
0
   def test_render_file_with_instance_variables

Comments

    No one has commented yet.