# Did\_not\_yield

**URL:** <https://www.ruby-forum.com/t/did-not-yield/159220>\
**Category:** Rails\
**Created:** [February 2, 2009, 2:34pm UTC](https://www.ruby-forum.com/t/did-not-yield/159220 "2009-02-02T14:34:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![raimon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/59ef9b/32.png) [@raimon](https://www.ruby-forum.com/u/raimon)\
**Post date:** [February 2, 2009, 2:34pm UTC](https://www.ruby-forum.com/t/did-not-yield/159220/1 "2009-02-02T14:34:59Z")

</div>

Hello,

I have some rudimentary code for loging into my app and database, it  
works ok (I think) but in Production, it does some strange things.

I’ve reduce the problem to a more simplest approach, without rendering,  
simply creating a variable of what should do.

Here is what I get in the log:

Processing ScannsController#status (for 127.0.0.1 at 2009-02-02  
14:24:25) [GET]  
Session ID: 595e081a5e726f0594f83652c3c2a9d5  
Filter chain halted as  
[#\<ActionController::Filters::AroundFilter:0x20470e8 @kind=:filter,  
@identifier=nil, @options={}, @method=:log\_test\>] did\_not\_yield.  
Completed in 0ms (DB: 12) | [[http://127.0.0.1/scanns/status](http://127.0.0.1/scanns/status)]

I think what it says is nothing happened ?

class ApplicationController \< ActionController::Base

…

protected ## attention, below here, all methods are PROTECTED

def log\_test

```
 session[:auth] ? (
 @time_left = (session[:expires_at] - Time.now).to_i
 @time_left<0 ? (
  flash[:notice] = 'Too much time without activity ...

```

login\_required '+session[:expires\_at].to\_s  
@login\_info='Too much time without activity … login\_required  
'+session[:expires\_at].to\_s  
) : (@login\_info=‘Updating session time’)  
yield  
) : (  
@login\_info=‘User not logged’)

end

…

end

In my controllers, I have this called:

class ScannsController \< ApplicationController

around\_filter :log\_test

def …

end

end

When there’s no [:auth] in the session, I’m getting the did\_not\_yield  
error …

If I understand it correctly, first checks if there’s a user in the auth  
session:

1. there’s a user =\> checks if the session has expired or not.  
1.1 If has expired =\> Too much time without activity  
1.2 If hasn’t expired =\> Updating session time

2. if there’s no user, simply User not logged

In my production app, when the session has expired, I’m getting always  
too much time without activity, and sometimes the did\_not\_yield …

I’m missing something here ???

thanks!

r.

Rails 2.2.2

---

<div class="post-metadata">

**Author:** ![raimon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/59ef9b/32.png) [@raimon](https://www.ruby-forum.com/u/raimon)\
**Post date:** [February 2, 2009, 3:15pm UTC](https://www.ruby-forum.com/t/did-not-yield/159220/2 "2009-02-02T15:15:52Z")

</div>

On 2 Feb 2009, at 13:34, Raimon Fs wrote:

> In my production app, when the session has expired, I’m getting always  
> too much time without activity, and sometimes the did\_not\_yield …
> 
> I’m missing something here ???

Start by not abusing the tertiary operator to write impenetrable  
code 🙂

Fred

---

<div class="post-metadata">

**Author:** ![raimon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/59ef9b/32.png) [@raimon](https://www.ruby-forum.com/u/raimon)\
**Post date:** [February 2, 2009, 3:47pm UTC](https://www.ruby-forum.com/t/did-not-yield/159220/3 "2009-02-02T15:47:14Z")

</div>

Frederick C. wrote:

> On 2 Feb 2009, at 13:34, Raimon Fs wrote:
> 
> > In my production app, when the session has expired, I’m getting always  
> > too much time without activity, and sometimes the did\_not\_yield …
> > 
> > I’m missing something here ???
> 
> Start by not abusing the tertiary operator to write impenetrable  
> code 🙂
> 
> Fred

I must recognize that I didn’t write that code, it would be impossible  
for me to do that …

🙂

I think I should refactor it …

thanks,

r.
