lib/nitro/dispatcher.rb in nitro-0.18.1 vs lib/nitro/dispatcher.rb in nitro-0.19.0

- old
+ new

@@ -138,47 +138,20 @@ end alias_method :split_path, :dispatch # Get the controller for the given key. # Also handles reloading of controllers. - #-- - # gmosx, FIXME: this method is a NASTY hack, anyone can - # help me fix this ? - #++ def controller_class_for(key, context) klass = @controllers[key] - if (:full == Rendering.reload) and context and context[:__RELOADED__].nil? and klass -#=begin - ancestors = [c = klass] - while (c = c.superclass) != Nitro::Controller - ancestors.unshift(c) + if klass and (:full == Rendering.reload) + klass.instance_methods.grep(/(action$)|(template$)/).each do |m| + klass.send(:remove_method, m) rescue nil end - - for c in ancestors - actions = c.public_instance_methods.find_all { |m| m.to_s =~ /(_action$)|(_template$)/ } - actions += c.action_methods - actions.each { |m| c.send(:remove_method, m) rescue nil } - c.advices = [] - - Object.send(:remove_const, c) rescue nil - load(c::DEF_FILE) - c = Object.const_get(klass.name.intern) - end -#=end -=begin - def_file = klass::DEF_FILE - # Object.send(:remove_const, klass) rescue nil - # FIXME: also reload superclasses! - Controller.remove_subclasses - load(def_file) -=end - klass = @controllers[key] = Object.const_get(klass.name.intern) - context[:__RELOADED__] = true end - - return klass + + return klass end end end