anthonygharvey.comRuby on Rails pluck methodActiveRecord is an important part of Ruby on Rails (the M in MVC) and is an Object Relational Mapping system (ORM) that maps the objects in your app to tables in your database. By using ActiveRecord (or any ORM) the attributes of your objects and the...Jul 16, 2024·3 min read
anthonygharvey.comRuby Array Set OperatorsHave you ever had an array that you only want to include unique elements? list_1 = ['apple', 'orange', 'grape'] list_2 = ['strawberry', 'apple'] combined_list = (list_1 + list_2).uniq combined_list #=> ["apple", "orange", "grape", "strawberry"] In t...Aug 14, 2019·2 min read
anthonygharvey.comRails Security Best Practices - Check For Unauthorized AccessThere are several security best practices to protect user data in Ruby on Rails applications. One of which is checking for unauthorized access by a user. This tutorial quickly shows how to check if a user has access to a particular resource before pe...Aug 4, 2019·2 min read
anthonygharvey.comGuard Clauses vs. Nested ConditionalsTLDR; a guard clause is a premature return (early exit) that "guards" against the rest of your code from executing if it's not necessary (based on criteria you specify). Soon after I started my career as a Ruby on Rails developer I learned about guar...Jul 28, 2019·2 min read
anthonygharvey.comStock Market Game - A React & Ruby on Rails ProjectFor my final project at Flatiron, I created The Anonymous Stock Trading Game. It was an idea I had several months ago and decided to make it my final project. My original idea was to show the first half of an anonymous chart before the game starts. T...Jul 7, 2019·5 min read