Learning Journal | Nearsoft Academy | Week 12
December 14— December 21
Hello! 👋 This is my twelfth-week takeaways being part of the Nearsoft Academy program, a space to learn, practice, and grow. I’ll post every week, all about the topics I’ve learned during this adventure.
This is almost the last week of contributions to open source, and this is what I learned from it.
Ruby / Ruby on rails
Validations
Rails have a helper that validates the state of objects before they go into the database.
It helps to ensure that only valid data is saved into the database. This is a simple example that validates that the acceptance field exists.
class Person < ApplicationRecord
validates :terms_of_service, acceptance: true
end
say_with_time
I used this function in one of my PR’s, it prints a message at the beginning then, you add some code into it that increments a counter, and when it returns an integer, it prints a message that says “rows” plus the integer return. In my case, I used it in a migration that modifies X number of rows, so it prints a message to indicate that a certain table is being modified and then it says which row was modified and at the end, it prints the number of rows modified.
Just one line
After practicing and coding with ruby, I noticed that with this language, you can do many things in just one line, it has some functions that could be implemented in a simple way that you can save some code by put them in the same line.
Contributions
Openfoodnetwork
Finally, I was able to finish this ruby issue and I already created the PR, after some days of researching about ruby and rails, I put everything together and I knew how to deal with this issue. It still needs a review after my last changes but it looks good so far.
Storybook
This week I’ve been working on a JS issue on the storybook project, the challenge here has been finding the best way to run the project and execute the samples to view the modifications I did, it works kind of tricky but now, I know where to edit and what to do to work on the issue.
If me
This is a very cool project about mental health, it has an objective to help people to share their mental health stories to get support from the community.
And another cool thing about this was that it was done with Ruby on Rails and React, so it is being really interesting working on this project and trying to understand how it works. I have not finish the issue, but I’m still working on it, I’m so excited about this project because I like its objective and the technologies they used to build it.