Class: Folder

Inherits:
ApplicationRecord show all
Defined in:
app/models/folder.rb

Overview

Folder model. Each instance of this class represents a single folder to which a user can add feeds.

Each folder belongs to a single user, and each user can have many folders (one-to-many relationship).

Each folder can be associated with many feeds, and each feed can be associated with many folders as long as they belong to different users (many-to-many relationship, through the feed_folders table). However a feed can be associated with at most one folder belonging to a single user.

A relationship is also established between Folder and Entry models, through the Feed model. This enables us to retrieve all entries for all feeds inside a folder.

The title field is mandatory. As it is introduced by the user, it is sanitized before saving in the database.

A given user cannot have two folders with the same title. Folders with the same title are allowed as long as they belong to different users.

The subscriptions_updated_at attribute is the date/time at which a feed in the folder was last changed. Events that update this attribute are:

- unsubscribing from a feed in the folder
- changing the unread entries count for a feed in the folder
- changing the title of a feed in the folder
- changing the URL of a feed in the folder
- moving a feed into or out of the folder

Constant Summary collapse

NO_FOLDER =

Class constants for special “no folder” and “all folders” cases

'none'
ALL_FOLDERS =
'all'