<% @users.each do |user| %>
<% user.tests.each do |f| %>
<%= f.title %>
<% end %>
<% end %>
# app/controllers/application.rb
after_action :user_activity
private
def user_activity
current_user.try :touch
end
# app/models/user.rb
ONLINE_PERIOD = 5.minutes
scope :online, -> { where('updated_at > ?', ONLINE_PERIOD.ago) }
def online?
updated_at > ONLINE_PERIOD.ago
end
User.online # все пользователи онлайн
rake db:drop; rake db:create; rake db:migrate; rake db:seed
rdd; rdc; rdm; rds