Commit 6de93ff844eb1e1fb599fa0c25bb217dfeca017e
- Date: Wed Jul 09 00:37:56 +0000 2008
- Committer: David Koontz (david@koontzfamily.org)
- Author: David Koontz (david@koontzfamily.org)
- Commit SHA1: 6de93ff844eb1e1fb599fa0c25bb217dfeca017e
- Tree SHA1: 3dd88bd8b27a45db8b49a1de3717815c1913ad51
Clarifying documentation of when controller/view load methods are invoked. Ensured model is instantiated before model.
Commit diff
| |   |
| 210 | 210 | end |
| 211 | 211 | |
| 212 | 212 | def initialize |
| 213 | | @__view = create_new_view unless self.class.view_class.nil? |
| 214 | 213 | @__model = create_new_model unless self.class.model_class.nil? |
| 214 | @__view = create_new_view unless self.class.view_class.nil? |
| 215 | 215 | @__transfer = {} |
| 216 | 216 | @__nested_controllers = {} |
| 217 | 217 | @__view_state = nil |
| toggle raw diff |
--- a/lib/monkeybars/controller.rb
+++ b/lib/monkeybars/controller.rb
@@ -210,8 +210,8 @@ module Monkeybars
end
def initialize
- @__view = create_new_view unless self.class.view_class.nil?
@__model = create_new_model unless self.class.model_class.nil?
+ @__view = create_new_view unless self.class.view_class.nil?
@__transfer = {}
@__nested_controllers = {}
@__view_state = nil |
| |   |
| 396 | 396 | end |
| 397 | 397 | |
| 398 | 398 | # Stub to be overriden in sub-class. This is where you put the code you would |
| 399 | | # normally put in initialize, it will be called whenever a new class is instantiated |
| 399 | # normally put in initialize. Load will be called whenever a new class is instantiated |
| 400 | # which happens when the Controller's instance method is called on a non-instantiated |
| 401 | # controller. Thus this method will always be called before the Controller's |
| 402 | # load method (which is called during Controlller#open). |
| 400 | 403 | def load; end |
| 401 | 404 | |
| 402 | 405 | # Stub to be overriden in sub-class. This is called whenever the view is closed. |
| toggle raw diff |
--- a/lib/monkeybars/view.rb
+++ b/lib/monkeybars/view.rb
@@ -396,7 +396,10 @@ module Monkeybars
end
# Stub to be overriden in sub-class. This is where you put the code you would
- # normally put in initialize, it will be called whenever a new class is instantiated
+ # normally put in initialize. Load will be called whenever a new class is instantiated
+ # which happens when the Controller's instance method is called on a non-instantiated
+ # controller. Thus this method will always be called before the Controller's
+ # load method (which is called during Controlller#open).
def load; end
# Stub to be overriden in sub-class. This is called whenever the view is closed. |