<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Silver on Medium]]></title>
        <description><![CDATA[Stories by Silver on Medium]]></description>
        <link>https://medium.com/@SilverC?source=rss-72160e41f08d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*hGCkNihuIJKG0R7NiMXlUA.png</url>
            <title>Stories by Silver on Medium</title>
            <link>https://medium.com/@SilverC?source=rss-72160e41f08d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 14:34:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@SilverC/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Hello World!]]></title>
            <link>https://medium.com/@SilverC/hello-world-780378eeaace?source=rss-72160e41f08d------2</link>
            <guid isPermaLink="false">https://medium.com/p/780378eeaace</guid>
            <category><![CDATA[back-again]]></category>
            <dc:creator><![CDATA[Silver]]></dc:creator>
            <pubDate>Sun, 16 May 2021 08:37:01 GMT</pubDate>
            <atom:updated>2021-05-16T08:37:01.310Z</atom:updated>
            <content:encoded><![CDATA[<p>Guess who is back! Back again! Silver is back! Tell a friend!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*qIVTPphdIcDWshX7sM1yPg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=780378eeaace" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rails Engine Analytics]]></title>
            <link>https://medium.com/@SilverC/rails-engine-analytics-4db73c1f0e6d?source=rss-72160e41f08d------2</link>
            <guid isPermaLink="false">https://medium.com/p/4db73c1f0e6d</guid>
            <category><![CDATA[api-development]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[serializers]]></category>
            <dc:creator><![CDATA[Silver]]></dc:creator>
            <pubDate>Mon, 28 Jan 2019 01:24:11 GMT</pubDate>
            <atom:updated>2019-01-28T01:24:11.873Z</atom:updated>
            <content:encoded><![CDATA[<p>Developing my first API! Kind-Of</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vDbvQLCnKeuDK8QsSyQHcg.jpeg" /><figcaption>by Tsahi Levent-Levi</figcaption></figure><p>Rails Engine is a Ruby on Rails API that has the capability to import data from CSV files and uses Netflix’s Fast JSON API serializer to deliver business intelligence endpoints. This application was my introductory project for APIs and Serializers. I must say, I’ve been impressed with the capabilities of API’s. Here are some lyrics from some Disney movie, “It’s a whole new world,” but really.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FhZ1Rb9hC4JY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DhZ1Rb9hC4JY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FhZ1Rb9hC4JY%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/67f38878dab92527efc7c4497bd0a325/href">https://medium.com/media/67f38878dab92527efc7c4497bd0a325/href</a></iframe><p>Application Programming Interface(API), according to Wikipedia, is a set of subroutine definitions, communication protocols, and tools for building software. The analogy that helped me understand goes as follows. If we got to a sit-down restaurant we will most likely have a waiter/waitress that communicates our order to the kitchen. In this particular case, the API is the waiter/waitress, they receive a request, collect/process the response and then return with that response(our delicious pumpkin pie).</p><p>Now that I have you singing one of Disney’s classics, I will inform you of my first experience building an API and some things that I should have done differently. My initial approach to the project was very ineffective and therefore caused me more time in the long run. One of the most important steps that you can do is to create an entity-relational diagram(ERD). The one shown below is the one that I used for Rails Engine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LoaWXy8oY1Rrihb18XH7Gw.png" /><figcaption>Entity Relational Diagram</figcaption></figure><p>The most challenging part of the project to me was the business intelligence endpoints. Building large queries does prove to be a challenging task, especially if you are doing the famous spaghetti on the wall approach. Having said that, getting a business intelligent endpoint to pass was probably one of the most satisfying parts of this project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5KjhJR0dQvI7kOySx3-UJA.png" /><figcaption>Simple yet beautiful.</figcaption></figure><p>If I could redo the project all over again, I would doubtlessly take a longer time initially setting everything up. I can’t stress enough how important it is to have all the relations mapped out and have the outline of the big picture. Having said that, It is critical to keep an agile workflow and follow the best path. Another portion of my Rails Engine that suffered was Test Driven Development (TDD) which was not strong towards the end. This was due to lack of time, but as stated above taking that extra time to write a test or to plan the project will save you time in the long run.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*_QucW1DzgCF0Bk8oT7m9Zg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4db73c1f0e6d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Constructing a personal rails assistant An introduction to FactoryBot!]]></title>
            <link>https://medium.com/@SilverC/constructing-a-personal-rails-assistant-an-introduction-to-factorybot-8f1ad59ae178?source=rss-72160e41f08d------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f1ad59ae178</guid>
            <category><![CDATA[factorybot]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[tdd]]></category>
            <dc:creator><![CDATA[Silver]]></dc:creator>
            <pubDate>Wed, 07 Nov 2018 20:06:25 GMT</pubDate>
            <atom:updated>2022-10-06T17:05:23.908Z</atom:updated>
            <content:encoded><![CDATA[<h3>Constructing a personal rails assistant (An introduction to FactoryBot!)</h3><p>Recently I have been learning Ruby on Rails or more commonly just simply known as Rails. For those that are unfamiliar, Rails is a framework used to build web applications. If we want to be more specific Rails is a software library that extends the Ruby programming language functionality. Due to the friendliness of the Ruby language, Rails has grown in popularity throughout the last couple of years. The large support allows rails to morph into whatever direction it needs to go(There is a Gem for everything).</p><p>Awesome! I am assuming that if you are reading this you are probably already using rails and know some basics, so let’s get to the juicy part. It all starts with TDD or Test Driven Development, In this case, we will be using RSpec which is a domain specific language that is written in ruby to test ruby code. In my developer upcoming, I have been brought up to strictly practice TDD. In doing so, there have been many instances where I have been in need of making dummy data for all my testing. Depending on how your database is structured as far as relationships and the object that your database contains, this could become a very long time-consuming process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*684VqwZSQRqxjiQbvFbk4A.png" /></figure><p>Have no fear! We can use Factorybot!</p><p>Alright, so what is Factorybot? Factorybot, originally known as FactoryGirl, is a software library which is ruby specific, it was designed to provide factory methods(methods that have creational patterns) to quickly create objects. This can come in very handy primarily for testing and depending on the specific data needed, sometimes for your seeding. I view Factorybot as my testing personal assistant. In the timeframe that I have been using it, it has easily saved me twice the amount of time, it sure beats out creating each individual object for every needed test.</p><p>Lets get started, We are going to need the following gem placed under the (group :development, :test do) as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uc3YAgbEaSptZm04SDY87w.png" /><figcaption>Gemfile</figcaption></figure><p>Awesome! let run Bundle install to obtain the Gem’s functionality. We will now create the folder structure that we will need in order to organize our FacoryBot helpers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*1MTaoV_1j5OIdpQpZ_7LUA.png" /></figure><p>We have a few more steps before we can start creating objects. We will now have to insert this code</p><pre>RSpec.configure do |config|<br>  config.include FactoryBot::Syntax::Methods<br>end</pre><p>In the following path: spec/support/factory_bot.rb as pictured above. Finally, the last step, Uncomment the following code in our rails_helper.</p><pre>Dir[Rails.root.join(&#39;spec/support/**/*.rb&#39;)].each { |f| require f }</pre><p>Let&#39;s get out Factorybot helper working! I am going to start you with the most basic way to create something.</p><pre>FactoryBot.define do<br>  factory :user do<br>    name { &quot;Stark&quot; }<br>  end<br>end</pre><p>Awesome! We have successfully created our first Factorybot object. Everytime that we need a user we can use the code below.</p><pre>user = create(:user)</pre><p>We have now created a User with a name of “Stark”, If we wanted to add more attributes other than name to a user, we would simply follow the same format where the name is and continue adding more attributes. Okay so we can make users but they are all going to be the same, how can we make this dynamic? I am glad you asked. We can make things dynamic by doing the following code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*T1kq3uPcHqzlUgVAAgk1dw.png" /><figcaption>making things dynamic.</figcaption></figure><p>What is happening in the code above? Like the first factory we created, we are naming each specific attribute except this time around we add a sequence in front. If we observe the code that is after the attribute, we have |n| that is going to be a number incrementing by 1 every time there is a new user created. That |n| is then placed in the string which also increases in the count, for example, the first user we make would have an email of (user_1@gmail.com), (Password 1) and so on. The second user would have (user_2@gmail.com), (Password 2). This allows our factories to create as many objects as we need and continue to be dynamic. If we wanted to increment the n value for each user, since we are using ruby, we can add or subtract from |n| variable. For example, if we wanted to multiples of 10 for each |n| value, we would be able to do something like this.</p><pre>FactoryBot.define do<br>  factory :song do<br>    sequence(:title) {|n| &quot;Title #{n}&quot; }<br>    sequence(:length) {|n| n*10 }<br>    play_count { 0 }<br>    artist<br>  end<br>end</pre><p>The couple lines of code above save us from having to hardcode all the needed objects. The code below has an example of what that would look like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hhB8VPw8lCYSRbCbavzTIA.png" /><figcaption>FactoryBot vs hardcode</figcaption></figure><p>If we look at the code above at first it might not seem to bad, but if we are going to have to make multiple users the keystrokes you save in the long run start adding up.</p><p>We have now seen how to make multiple Users with unique attributes using our Factorybot helper. The last thing that I am going to show you is how to make associations. Let&#39;s say we have to attach a User to a specific Item, the code below shows us how we would make the association using the Factorybot syntax.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YtgQGaBlB-qDrpsB6OjDXw.png" /></figure><p><strong>Summary</strong> <br>Overall there are many other useful ways that Factorybot can be implemented in Test Driven Development. This brief intro was designed to open the door to what Factorybot can offer. I hope this caught your interest, I will post more thorough resources below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/514/1*P4n_Li1xwwtD2Ii2bVazvw.png" /></figure><p><strong>Sources:</strong></p><ul><li><a href="http://backend.turing.io/module2/lessons/factory_bot">FactoryBot - Back-End Engineering Curriculum - Turing School of Software and Design</a></li><li><a href="https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#configure-your-test-suite">thoughtbot/factory_bot</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f1ad59ae178" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>