Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Session 2 Editorial #105

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

abhishekkumar2718
Copy link
Member

@abhishekkumar2718 abhishekkumar2718 commented Jan 25, 2021

The second session was more straightforward than the first two, as it built directly upon the concepts explained.

t.string :name
t.string :roll_number
t.string :branch
t.decimal :cgpa, precision: 4, scale: 2
Copy link
Member Author

Choose a reason for hiding this comment

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

Precision - Number of digits.
Scale - Number of digits after the decimal point.

Since CGPA has two digits after the decimal point and lies between 0 and 10, it will have scale of 2 and precison of 4.

But precision of 4 implies that 12.34 is valid CGPA, after it has 4 digits (precision) and 2 digits after decimal (scale).

Therefore, I have added a validation in app/models/student.rb to limit CGPA between 0 and 10.

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

Successfully merging this pull request may close these issues.

1 participant