badgooooor / nimble-internship

Code challenge for Nimble
0 stars 0 forks source link

Incorrect casing and naming of model assocations #14

Closed olivierobert closed 4 years ago

olivierobert commented 4 years ago

In the model User, there is a mix of casing, syntax and naming issues:

# Bad
has_many :roleResources, dependent: :destroy

# Good
has_many :role_resources, dependent: :destroy

In Ruby, follow the underscore casing (A.K.A. kebab casing).

# Bad (> 1.9.0 syntax)
has_many :courses, :through => :course_user

# Good
has_many :courses, through: :course_user
# Bad
has_many :course_user
has_many :group_user

# Good
has_many :course_users
has_many :group_users

has_many must be pluaralized

olivierobert commented 4 years ago

USing Robocop onto the project would assist you in following Ruby best practices.