Creates devices table and associations#507
Conversation
Current Code Coverage Percent of this PR:89.42 %Files having coverage below 100%
|
app/models/device.rb
Outdated
|
|
||
| # Validations | ||
| after_initialize :set_default_specifications, if: :new_record? | ||
| validates :model, length: { maximum: 100 } |
There was a problem hiding this comment.
Could the model attribute be renamed to model_name?
There was a problem hiding this comment.
Hi, what's the reason?
There was a problem hiding this comment.
@keshavbiswa @rohitjoshixyz Renaming it as "Name"(Top level) as if I use model_name as column name, it gives this error.
Failure/Error: it { is_expected.to belong_to(:issued_by) }
ActiveRecord::DangerousAttributeError:
model_name is defined by Active Record. Check to make sure that you don't have an attribute or method with the same name.
There was a problem hiding this comment.
Model attribute is confusing with rails models. We can rename it to device_model
There was a problem hiding this comment.
Hey, as I mentioned. I have renamed it as "Name". Please check files once.
|
Oh okay so the name means the device's model. Sure I am fine with this 👍. PR is already approved from me✌🏻 |
Yes. Thanks! |
| it { | ||
| expect(subject).to define_enum_for(:device_type).with_values( | ||
| laptop: "laptop", | ||
| mobile: "mobile").backed_by_column_of_type(:string) | ||
| } | ||
| end |
There was a problem hiding this comment.
Use do end instead of {} for multi line blocks.
* Creates devices table and associations * remove unrelated changes from schema * Capitalize comments * Renaming column 'model' as 'name' * removing unrelated changes from schema.rb * Adds test for enum
Notion card
https://www.notion.so/saeloun/Add-tables-for-personal-employment-Allocated-devices-Address-71ef49d0c38e4242bd2998120141372d
Summary
Preview
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
On Rails console as well as RSpecs Test run.
Checklist: