Nick,
> how can i count sessions??
> Like ex. 50 users logged on
Have a look at the Beast project code:
http://svn.techno-weenie.net/projects/beast/
http://beast.caboo.se/forums/1/topics/4
Usage (in view)
...
Guests online: <%= Session.active_count %>
...
Implementation:
file: model/session.rb
Session = CGI::Session::ActiveRecordStore::Session
Session.class_eval do
def self.active_count
count(:all, :conditions => ["updated_at > ?",
Time.now.utc-5.minutes])
end
end
! it requires you store sessions in the db :
=> in environment.rb, uncomment:
...
config.action_controller.session_store = :active_record_store
...
Alain
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---