Skip to content

Commit

Permalink
more attention to "render :super". closes issue #499. the tricks were…
Browse files Browse the repository at this point in the history
… to hunt for an extension separately (using rails' existing method), bypass file_exists? by using File.file?, and send :use_full_path => false to the render :file.

git-svn-id: http://activescaffold.googlecode.com/svn/trunk@711 561dde7e-7729-0410-be8e-ef83869d6c7d
  • Loading branch information
cainlevy committed Jan 16, 2008
1 parent a6b20da commit 0f379db
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/extensions/action_view_rendering.rb
Expand Up @@ -33,11 +33,14 @@ def render_with_active_scaffold(*args, &block)
# solution is to count colons from the *right* of the string, not the left. see issue #299.
template_path = caller.find{|c| known_extensions.include?(c.split(':')[-3].split('.').last.to_sym) }
template = File.basename(template_path).split('.').first

active_scaffold_config.template_search_path.each do |active_scaffold_template_path|
next if template_path.include? active_scaffold_template_path
active_scaffold_template = File.join(active_scaffold_template_path, template)
return render(:file => active_scaffold_template, :locals => options[:locals]) if file_exists? active_scaffold_template

path = File.join(active_scaffold_template_path, template)
extension = find_template_extension_from_handler(path)
template = "#{path}.#{extension}"

return render(:file => template, :locals => options[:locals], :use_full_path => false) if File.file? template
end
elsif args.first.is_a?(Hash) and args.first[:active_scaffold]
require 'digest/md5'
Expand Down

0 comments on commit 0f379db

Please sign in to comment.