Displaying 1 result from an estimated 1 matches for "mystrategy".
Did you mean:
gcstrategy
2006 Mar 10
3
Changes to class caching between Rails 0.14.3 and 1.0?
...the strategy pattern in the following manner:
1. Set an accessor for the class, let''s call it :strategy
class Widget
cattr_accessor :strategy
end
2. In environment.rb, we instantiate an object that implements the
strategy and use the accessor to set it for the class
strat = MyStrategy.new
Widget.strategy = strat
3. In the regular flow of the application, that strategy gets accessed
so it can affect some behavior:
...
Widget.strategy.do(:foo)
...
OK, now in development mode, class caching is off. In Rails 0.14.3 this
didn''t seem to matter -- the class variab...