This can be rewritten as:

```ruby
session[:requested_path] = request.method == 'GET' ? request.path : request.referer
```