builtin/controllers/rtml_controller.rb in rtml-2.0.3 vs builtin/controllers/rtml_controller.rb in rtml-2.0.4
- old
+ new
@@ -11,12 +11,20 @@
end
hide_action :rtml_document, :rtml_exception
hide_action :screen_layout, :embedded_app
helper_method :screen_layout, :embedded_app
-
rescue_from Exception, :with => :rtml_exception
+
+ # These are instance variables which will not be copied into RTML Actions or Widgets.
+ class_inheritable_array :rtml_protected_instance_variables
+ read_inheritable_attribute(:rtml_protected_instance_variables) ||
+ write_inheritable_attribute(:rtml_protected_instance_variables, %w(
+ @during_finalization_blocks @terminal_state @rtml_helpers @exception @rtml_document @_request
+ @render_proxy @real_format @update @template
+ ))
+ delegate :rtml_protected_instance_variables, :to => "self.class"
def rtml_exception
add_view_path(File.expand_path(File.join(Rtml.root, 'builtin/views')))
method = (ENV['RAILS_ENV'] == 'production') ? 'rescue_action_in_public' : 'rescue_action_locally'
@@ -26,10 +34,12 @@
rtml = request.rtml? if request.respond_to?(:rtml?)
rtml = response.rtml? if response.respond_to?(:rtml?)
if (params[:error_mode] == 'rtml' || rtml) && rtml_helpers.respond_to?(method)
@exception = $!
+ Rails.logger.error $!.message
+ Rails.logger.error $!.backtrace.join("\n ")
rtml_document.reset!
erase_results
render :rtml => method
else
raise $!
@@ -47,9 +57,10 @@
def rtml_document
@rtml_document ||= Rtml::Document.new(:name => "#{controller_name}/#{action_name}",
:view_paths => view_paths,
:controller => self)
end
+
protected
def add_view_path(path)
view_paths << path
rtml_document.view_paths << path