jcasimir/draper — Issue #46: Accessing session from Decorator
Author: pfeiffer
Created: 2011-10-13 10:24:22+00:00
State: open

I've run into some problems when accessing `session` in a decorator method:

A basic test controller:

```
class TestController < ...
def test_page
session[:test] ||= 0
session[:test] += 1
..
end
end
```

With a decorator:

```
class TestDecorator < ...
def test
h.session[:test]
end
end
```

In a view:

```
Actual session value: <%= session[:test] %>
Decorator value: <%= @decorator.test %>
```

The first page load displays the same value, but afterwards the value returned by the decorator isn't updated as the session value changes.