Skip to content

Conversation

@Smullz622
Copy link
Contributor

Fixes #226

For now, unit_id is allowed to be null for users so it doesn't break existing users. Once those have been assigned a unit, we should probably update so that users must have a unit to make sure pages are all accounted for

@Smullz622 Smullz622 requested a review from a team as a code owner February 3, 2026 18:29
Comment on lines 7 to 8
t.integer :daily_page_limit
t.integer :overall_page_limit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably have these configured as "null: false" and add some defaults just to be sure on the database level we are not getting anything weird. Probably something pretty restrictive like 30 pages a day and 25,000 total. We should confirm with @binkylush that this sounds okay.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Binky confirmed those are a good place to start

Comment on lines 8 to 9
validates :daily_page_limit, presence: true
validates :overall_page_limit, presence: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these would be better like validates :daily_page_limit, numericality: { only_integer: true, greater_than_or_equal_to: 0 }. To be sure we know what we're getting won't cause issues downstream.

@Smullz622 Smullz622 requested a review from ajkiessl February 3, 2026 19:52
Copy link
Contributor

@ajkiessl ajkiessl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create "Unit" ActiveRecord Model

3 participants