Merge branch 'master' into erbout
This commit is contained in:
commit
9c9da5d927
@ -530,7 +530,7 @@ def initialize_defaults(method_name)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def render_message(method_name, body)
|
def render_message(method_name, body)
|
||||||
render :file => method_name, :body => body
|
render :file => method_name, :body => body, :use_full_path => true
|
||||||
end
|
end
|
||||||
|
|
||||||
def render(opts)
|
def render(opts)
|
||||||
@ -538,6 +538,7 @@ def render(opts)
|
|||||||
if opts[:file] && opts[:file] !~ /\//
|
if opts[:file] && opts[:file] !~ /\//
|
||||||
opts[:file] = "#{mailer_name}/#{opts[:file]}"
|
opts[:file] = "#{mailer_name}/#{opts[:file]}"
|
||||||
end
|
end
|
||||||
|
opts[:use_full_path] = true
|
||||||
initialize_template_class(body).render(opts)
|
initialize_template_class(body).render(opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -252,6 +252,7 @@ def render(options = {}, local_assigns = {}, &block) #:nodoc:
|
|||||||
elsif options == :update
|
elsif options == :update
|
||||||
update_page(&block)
|
update_page(&block)
|
||||||
elsif options.is_a?(Hash)
|
elsif options.is_a?(Hash)
|
||||||
|
use_full_path = options[:use_full_path]
|
||||||
options = options.reverse_merge(:locals => {}, :use_full_path => true)
|
options = options.reverse_merge(:locals => {}, :use_full_path => true)
|
||||||
|
|
||||||
if partial_layout = options.delete(:layout)
|
if partial_layout = options.delete(:layout)
|
||||||
@ -265,7 +266,7 @@ def render(options = {}, local_assigns = {}, &block) #:nodoc:
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
elsif options[:file]
|
elsif options[:file]
|
||||||
render_file(options[:file], options[:use_full_path], options[:locals])
|
render_file(options[:file], use_full_path || false, options[:locals])
|
||||||
elsif options[:partial] && options[:collection]
|
elsif options[:partial] && options[:collection]
|
||||||
render_partial_collection(options[:partial], options[:collection], options[:spacer_template], options[:locals])
|
render_partial_collection(options[:partial], options[:collection], options[:spacer_template], options[:locals])
|
||||||
elsif options[:partial]
|
elsif options[:partial]
|
||||||
|
@ -22,10 +22,10 @@ def render
|
|||||||
end
|
end
|
||||||
|
|
||||||
def render_member(object)
|
def render_member(object)
|
||||||
@locals[@counter_name] += 1
|
|
||||||
@locals[:object] = @locals[@variable_name] = object
|
@locals[:object] = @locals[@variable_name] = object
|
||||||
|
|
||||||
template = render_template
|
template = render_template
|
||||||
|
@locals[@counter_name] += 1
|
||||||
@locals.delete(@variable_name)
|
@locals.delete(@variable_name)
|
||||||
@locals.delete(:object)
|
@locals.delete(:object)
|
||||||
|
|
||||||
|
@ -68,6 +68,11 @@ def render_file_with_instance_variables
|
|||||||
path = File.join(File.dirname(__FILE__), '../fixtures/test/render_file_with_ivar.erb')
|
path = File.join(File.dirname(__FILE__), '../fixtures/test/render_file_with_ivar.erb')
|
||||||
render :file => path
|
render :file => path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def render_file_from_template
|
||||||
|
@secret = 'in the sauce'
|
||||||
|
@path = File.expand_path(File.join(File.dirname(__FILE__), '../fixtures/test/render_file_with_ivar.erb'))
|
||||||
|
end
|
||||||
|
|
||||||
def render_file_with_locals
|
def render_file_with_locals
|
||||||
path = File.join(File.dirname(__FILE__), '../fixtures/test/render_file_with_locals.erb')
|
path = File.join(File.dirname(__FILE__), '../fixtures/test/render_file_with_locals.erb')
|
||||||
@ -531,6 +536,11 @@ def test_render_file_with_locals
|
|||||||
get :render_file_with_locals
|
get :render_file_with_locals
|
||||||
assert_equal "The secret is in the sauce\n", @response.body
|
assert_equal "The secret is in the sauce\n", @response.body
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_render_file_from_template
|
||||||
|
get :render_file_from_template
|
||||||
|
assert_equal "The secret is in the sauce\n", @response.body
|
||||||
|
end
|
||||||
|
|
||||||
def test_attempt_to_access_object_method
|
def test_attempt_to_access_object_method
|
||||||
assert_raises(ActionController::UnknownAction, "No action responded to [clone]") { get :clone }
|
assert_raises(ActionController::UnknownAction, "No action responded to [clone]") { get :clone }
|
||||||
@ -742,7 +752,7 @@ def test_partial_collection
|
|||||||
|
|
||||||
def test_partial_collection_with_counter
|
def test_partial_collection_with_counter
|
||||||
get :partial_collection_with_counter
|
get :partial_collection_with_counter
|
||||||
assert_equal "david1mary2", @response.body
|
assert_equal "david0mary1", @response.body
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_partial_collection_with_locals
|
def test_partial_collection_with_locals
|
||||||
@ -762,7 +772,7 @@ def test_partial_collection_shorthand_with_locals
|
|||||||
|
|
||||||
def test_partial_collection_shorthand_with_different_types_of_records
|
def test_partial_collection_shorthand_with_different_types_of_records
|
||||||
get :partial_collection_shorthand_with_different_types_of_records
|
get :partial_collection_shorthand_with_different_types_of_records
|
||||||
assert_equal "Bonjour bad customer: mark1Bonjour good customer: craig2Bonjour bad customer: john3Bonjour good customer: zach4Bonjour good customer: brandon5Bonjour bad customer: dan6", @response.body
|
assert_equal "Bonjour bad customer: mark0Bonjour good customer: craig1Bonjour bad customer: john2Bonjour good customer: zach3Bonjour good customer: brandon4Bonjour bad customer: dan5", @response.body
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_empty_partial_collection
|
def test_empty_partial_collection
|
||||||
|
1
actionpack/test/fixtures/test/render_file_from_template.html.erb
vendored
Normal file
1
actionpack/test/fixtures/test/render_file_from_template.html.erb
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
<%= render :file => @path %>
|
Loading…
Reference in New Issue
Block a user