lib/happy/context.rb in happy-0.1.0.pre.2 vs lib/happy/context.rb in happy-0.1.0.pre.3
- old
+ new
@@ -20,11 +20,13 @@
def with_controller(new_controller)
# remember previous controller
old_controller = self.controller
self.controller = new_controller
- # execute permissions block
- controller.class.permissions_blk.try(:call, permissions, self)
+ # execute permissions block SMELL - better integration
+ if controller.class.respond_to?(:permissions_blk)
+ controller.class.permissions_blk.try(:call, permissions, self)
+ end
# execute block
yield
ensure
# switch back to previous controller