app/models/user.rb
# Connects this user object to Blacklights Bookmarks.
Connects this user object to Blacklights Bookmarks.
Connects this user object to Blacklights Bookmarks .
def delete_guests
    days_old = 1.days
    older_than  = DateTime.now - days_old
    expired_guests = User.where(:guest => true).where(["created_at < ?", older_than])
    inner_query = expired_guests.select("users.id")
    users = expired_guests.delete_all
    bookmarks = Bookmark.where(:user_id => inner_query).delete_all
    searches  = Search.where(:user_id => inner_query).delete_all
  end
def delete_guests days_old = 1 . days older_than = DateTime . now - days_old expired_guests = User . where ( :guest => true ) . where ( [ "created_at < ?" , older_than ] ) inner_query = expired_guests . select ( "users.id" ) users = expired_guests . delete_all bookmarks = Bookmark . where ( :user_id => inner_query ) . delete_all searches = Search . where ( :user_id => inner_query ) . delete_all end
Connects this user object to Blacklights Bookmarks.
Connects this user object to Blacklights Bookmarks .