01 Jul 2016
Reading time ~2 minutes
What I Did
- Today I further refactored controller related things mostly in
- I wrote integration tests for up/down voting for the simple case in which a given post has no votes currently.
What I Learned
data-remote: truewithin a given form.
- Object-relational mapping (ORM) - is a programming technique for converting data between incompatible type systems in object-oriented programming languages. This creates a virtual object database that can be used from within the programming language. ActiveRecord is the default object-relational mapping library for Rails.
- Memoization is the process of storing a computed value to avoid duplicated work by future calls. This is a handy technique for accessing instance variables in much less time than allowing however many lines of code within a given method to run each time one seeks to retrieve a oft-required variable.
- Session and params are only available to the controller. Specs are do not have access (inherently) to these resources.
- Setting null constraints on text columns may generate problems down the line (especially when working with MySQL).
- FactoryGirl traits allows for unique factories to be generated efficiently.
- Pry and the Capybara save_and_open_page method are the best thing to ever happen to Ruby on Rails.
- Implementing a counter cache when appropriate is a good alternative to excessive database access through repetitive SQL calls.
What I Still Don’t Understand
- After rebasing a given branch with another, I’ve been simply force pushing the updated branch to GitHub, and I’m not sure if there is a more appropriate action to take (although I’m suspicious there is).
What I’d Like To Learn
- I’d like to get more and more familiar with the internal of Ruby and Rails, because I feel that my surface level understanding is fine and dandy for a link aggregator site, but won’t do me enough good for debugging a full-scale production site that is actually heavily utilized in real life.