Changeset 713
- Timestamp:
- 02/20/05 13:50:13 (4 years ago)
- Files:
-
- trunk/actionpack/lib/action_controller/base.rb (modified) (2 diffs)
- trunk/actionpack/lib/action_controller/components.rb (modified) (3 diffs)
- trunk/actionpack/lib/action_controller/dependencies.rb (modified) (1 diff)
- trunk/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/lib/action_controller/base.rb
r646 r713 225 225 # Template root determines the base from which template references will be made. So a call to render("test/template") 226 226 # will be converted to "#{template_root}/test/template.rhtml". 227 c attr_accessor :template_root227 class_inheritable_accessor :template_root 228 228 229 229 # The logger is used for generating information on the action run-time (including benchmarking) if available. … … 298 298 def hide_actions(*names) 299 299 write_inheritable_attribute(:hidden_actions, hidden_actions | names.collect {|n| n.to_s}) 300 end 301 302 # Set the template root to be one directory behind the root dir of the controller. Examples: 303 # /code/weblog/components/admin/users_controller.rb with Admin::UsersController 304 # will use /code/weblog/components as template root 305 # and find templates in /code/weblog/components/admin/users/ 306 # 307 # /code/weblog/components/admin/parties/users_controller.rb with Admin::Parties::UsersController 308 # will also use /code/weblog/components as template root 309 # and find templates in /code/weblog/components/admin/parties/users/ 310 def uses_component_template_root 311 path_of_calling_controller = File.dirname(caller[0].split(/:\d+:/).first) 312 path_of_controller_root = path_of_calling_controller.sub(/#{controller_path.split("/")[0..-2]}$/, "") 313 self.template_root = path_of_controller_root 300 314 end 301 315 end trunk/actionpack/lib/action_controller/components.rb
r707 r713 3 3 def self.append_features(base) 4 4 super 5 base.helper { def render_component(options) @controller.send(:component_response, options).body end } 5 base.helper do 6 def render_component(options) 7 @controller.logger.info("Start rendering component (#{options.inspect}): ") 8 @controller.send(:component_response, options).body 9 @controller.logger.info("\n\nEnd of component rendering") 10 end 11 end 6 12 end 7 13 … … 9 15 def render_component(options = {}) #:doc: 10 16 response = component_response(options) 17 logger.info "Rendering component (#{options.inspect}): " 11 18 render_text(response.body, response.headers["Status"]) 19 logger.info("\n\nEnd of component rendering") 12 20 end 13 21 … … 23 31 def component_request(options) 24 32 component_request = @request.dup 25 component_request.send(:instance_variable_set, :@parameters, (options[:params] || {}).merge({ "controller" => options[:controller], "action" => options[:action] })) 26 component_request 33 component_request.send( 34 :instance_variable_set, :@parameters, 35 (options[:params] || {}).merge({ "controller" => options[:controller], "action" => options[:action] }) 36 ) 37 return component_request 27 38 end 28 39 end trunk/actionpack/lib/action_controller/dependencies.rb
r709 r713 90 90 end 91 91 end 92 93 Controllers = Dependencies::LoadingModule.new(File.expand_path(File.join(RAILS_ROOT, 'app', 'controllers'))) if defined?(RAILS_ROOT)trunk/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml
r709 r713 1 <% unless@exception.blamed_files.empty? %>1 <% if @exception.blamed_files && !@exception.blamed_files.empty? %> 2 2 <a href="#" onclick="document.getElementById('blame_trace').style.display='block'; return false;">Show blamed files</a> 3 3 <pre id="blame_trace" style="display:none"><code><%=h @exception.describe_blame %></code></pre>