Forum: Ruby on Rails did_not_yield

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Mongeta 9. (Guest)
on 2009-02-02 15:34
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]

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
Frederick C. (Guest)
on 2009-02-02 16:15
(Received via mailing list)
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
Mongeta 9. (Guest)
on 2009-02-02 16:47
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.
This topic is locked and can not be replied to.