<?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 Catherine Clause on Medium]]></title>
        <description><![CDATA[Stories by Catherine Clause on Medium]]></description>
        <link>https://medium.com/@cnclause123?source=rss-e8538c8a633e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*YIiruCOm1XBTzNq7DaXoTg.jpeg</url>
            <title>Stories by Catherine Clause on Medium</title>
            <link>https://medium.com/@cnclause123?source=rss-e8538c8a633e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 20:49:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cnclause123/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[Equality Operators: Interview Question Series]]></title>
            <link>https://medium.com/@cnclause123/equality-operators-interview-question-series-3acff59848bd?source=rss-e8538c8a633e------2</link>
            <guid isPermaLink="false">https://medium.com/p/3acff59848bd</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[flatiron-school]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Catherine Clause]]></dc:creator>
            <pubDate>Mon, 17 Feb 2020 04:21:52 GMT</pubDate>
            <atom:updated>2020-02-17T23:30:30.653Z</atom:updated>
            <content:encoded><![CDATA[<p>I am bringing it back to JavaScript basics! There is one question that I have come across in about 90% of my interviews. That question is ‘what is the difference between a double equal and a triple equal in JavaScript?’.</p><p>Let’s talk about it!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Vq1WWcSUoS4_QJzm" /><figcaption>Photo by <a href="https://unsplash.com/@uh?utm_source=medium&amp;utm_medium=referral">Matt Popovich</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Loose Equality Operator ( == , !=)</h3><p>This operator will return <strong>true </strong>if two values are equal. Before it makes the comparison, it converts the values to the same type. This means that if you are comparing a number and a string it will first convert the string to a number and then compare the values.</p><p>Example:</p><pre>24 == 24 <br>// true</pre><pre>24 == &#39;24&#39;<br>//true <br></pre><p><strong>!= </strong>acts the same way, except it will return <strong>true </strong>if two values are <strong>not </strong>equal</p><p>Example :</p><pre>24 != &#39;24&#39;<br>// false</pre><pre>24 != 25<br>// true</pre><pre>24 != &#39;25&#39;<br>//true<br></pre><h3>Strict Equality Operator ( === , !==)</h3><p>The strict equality operator will <strong>not </strong>complete type conversion before comparing the two values. This means that if you try to compare an integer and a string, it will return <strong>false. </strong>Let’s check out some examples.</p><p>Using === :</p><pre>22 === 22<br>//true </pre><pre>22 === &#39;22&#39;<br>// false</pre><p>The strict inequality operates the same way except it will return <strong>true </strong>if two values are <strong>not</strong> equal. It will also not complete type conversation before evaluating.</p><pre>22 !== 22<br>//false </pre><pre>22 !== 20<br>// true</pre><pre>22 !== &#39;22&#39;<br>// true</pre><p>Every time I explain the difference between these two equality comparisons, I give a simple example. This is helpful as I believe (or hope) it shows I understand the concept even though I may have gotten nervous in the interview and forgotten certain keywords or stumbled on the definition.</p><p>The example I always use is:</p><pre>1 === &#39;1&#39;<br>// false </pre><pre> 1 == 1<br>//true</pre><p>The interview process continues!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3acff59848bd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Types of Testing: Interview Question Series]]></title>
            <link>https://medium.com/@cnclause123/types-of-testing-interview-question-series-3c480ef2a466?source=rss-e8538c8a633e------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c480ef2a466</guid>
            <category><![CDATA[flatiron-school]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Catherine Clause]]></dc:creator>
            <pubDate>Sun, 09 Feb 2020 00:25:19 GMT</pubDate>
            <atom:updated>2020-02-09T00:25:19.829Z</atom:updated>
            <content:encoded><![CDATA[<p>A topic that I continue to come across in networking meetings and interviews is testing. There are a lot of different theories and implementations, but for this blog, I want to start off simple. What are some different types of testing?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*65Uru6N0XJQ4M9dC" /><figcaption>Photo by <a href="https://unsplash.com/@scienceinhd?utm_source=medium&amp;utm_medium=referral">Science in HD</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>1. Unit Testing</h3><p>Unit testing focuses on testing individual units or components. A time to use unit testing is when you want to check if a method or function is working as it is designed. This is the lowest level of testing.</p><h3>2. Integration Testing</h3><p>Integration tests are when individual units/components are combined and tested as a group. Integration testing is used to ensure that the interaction between the units is occurring properly without error.</p><h3>3. Regression Testing</h3><p>Regression testing is used to make sure that when code is updated, the program still runs as designed.</p><h3>4. Smoke Testing</h3><p>A smoke test is to make sure a program is ready to be reviewed by more refined tests. This testing is used to ensure that the main functionality is working. Examples of some questions that smoke testing could answer are “does the program run?” or “does anything happen when the home button is clicked”?</p><h3>5. Alpha Testing</h3><p>Alpha testing is done to find all possible bugs in the program before having the program released to the public.</p><h3>6. Beta Testing</h3><p>Beta tests are released to a limited number of customers or a specific group. This typically happens after alpha testing. Doing this allows development teams to gather more data on the product and any errors or issues that may occur.</p><h3>7. System Testing</h3><p>System testing is used to evaluate the system’s compliance with the specified requirements. This testing would be used to ensure that the program is able to run appropriately on different operating systems. This type of testing is usually performed by a team that is independent of the dev team.</p><h3>8. Stress Testing</h3><p>This testing is used to determine the stability and reliability of the program. It is created to push the program to its limits.</p><h3>9. Performance Testing</h3><p>Performance testing is used to test the run-time performance of a program. It is to ensure that a program will perform well under the expected workload.</p><p>This has been a very basic explanation of nine different tests. I look forward to learning more!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c480ef2a466" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Compiled vs Interpreted Implementation: Interview Question Series]]></title>
            <link>https://medium.com/@cnclause123/compiled-vs-interpreted-implementation-interview-question-series-aa0088b84ca4?source=rss-e8538c8a633e------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa0088b84ca4</guid>
            <category><![CDATA[flatiron-school]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[interview-questions]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Catherine Clause]]></dc:creator>
            <pubDate>Wed, 29 Jan 2020 22:50:54 GMT</pubDate>
            <atom:updated>2020-01-29T22:50:54.445Z</atom:updated>
            <content:encoded><![CDATA[<p>While I am on this journey to start my career as a software engineer, I thought it would be a good opportunity to write about the questions I was asked and unsure of the answers. I graduated from a 15-week immersive program so it only makes sense that I don’t know everything there is to know about computer science and programming (I mean who does? There is so much to learn!).</p><p>For this first blog, I decided to answer a question I was asked during a Site Reliability Engineer interview. The question was “What is the difference between a compiled language and an interpreted language?”</p><p>Let’s find out!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OhyhzNBMRATLtHUm" /><figcaption>Photo by <a href="https://unsplash.com/@josephandjosephandjoseph?utm_source=medium&amp;utm_medium=referral">Joseph Rosales</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>The Difference</h3><p>When a language uses a compiler it translates the code to machine code instructions that the processor executes. This happens <strong>before </strong>runtime. Additionally, it reads the code all in one go and responds if the program is correct or gives an error. Since it reads it all in one go, it will show each possible error.</p><p><em>Languages that are commonly placed in this category are C, C++, Go, Java, and Swift.</em></p><p>When a language uses interpretation it is compiled line-by-line <strong>during </strong>runtime. It compiles the first line then runs it, then compiles the second line then runs it, and so on. Since it is read line-by-line it stops when it encounters an error. This means that if an error is found on line 3 it will stop running. This difference makes interpreted languages run slower.</p><p><em>Common interpreted languages include JavaScript, Perl, and Python.</em></p><p>Based on my research the main difference seems to be speed. Some resources also mention that languages that use interpretation tend to be easier to read.</p><p>Hope this helps! Looking forward to exploring other technical interview questions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa0088b84ca4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Message to New Developers: Don’t Trust Blogs (Blindly)]]></title>
            <link>https://medium.com/@cnclause123/a-message-to-new-developers-dont-trust-blogs-blindly-bf5468f0f1da?source=rss-e8538c8a633e------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf5468f0f1da</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[codingbootcamp]]></category>
            <category><![CDATA[flatiron-school]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Catherine Clause]]></dc:creator>
            <pubDate>Tue, 19 Nov 2019 17:03:50 GMT</pubDate>
            <atom:updated>2019-11-19T17:03:50.856Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/395/1*_mifSvMDrUBq83z9NHCiwQ.png" /></figure><p>I am entering my 13th week as a software engineering student at Flatiron School and one of my biggest takeaways is how to problem solve and what resources to trust.</p><p>I have learned the hard way that trusting a blogpost fully, is not the way to go. I decided to follow a blog post on how to add authentication into my node.js backend, and it ended up being ethically not correct and keeping me from being able to deploy. Now this isn’t the author’s fault, this was my own. Instead of taking the time to read and understand any kind of docs, I trusted a blog post.</p><p>What I realized was that I am not even 3 months into being a software engineer and I had written technical blog posts or “how-tos” because it was a part of my requirement for school. While I hope they are accurate, it still should be taken into consideration that I may be missing something. That means that, just like everything else on the internet, you cannot put 100% of your trust into blogs, especially if you don’t know anything about the author.</p><p>With that being said, this is my recommendation.</p><p>Use the docs!</p><p>If you are using a specific package or technology/language then try and look up the docs and work through them. The docs are a much more reliable source than a blog post.</p><p>Use this as a tool! If you are still struggling with understanding something and there is a “how-to” blog that you want to follow — don’t follow it blindly! Read through it before implementing your code and see if the outcome of the blog matches up with the solution you are looking for. If it does, then take a step to compare code snippets from the blog post to any docs that you have found. If you see similar code, then that is a good sign!</p><p>Take the time to pull other resources and compare — keeping the docs with you as a guide.</p><p>While this may seem like common sense, I have found myself wanting to find a solution quick, and not taking the appropriate steps to seed through resources. Docs can also be intimidating, but the more you read them the easier it gets!</p><p><em>I don’t want to pretend that all docs are good docs. I think we can all agree there are some pretty poor docs out there. However, still pull resources! Don’t follow the first blog posts that pops up on google. Take your time to read, understand, and then implement</em>.</p><p>I want to save you from wasting time. While it may take more time in the beginning to do your research, it will save you time in the end. That is a guarantee.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf5468f0f1da" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From a Master’s Program to a Software Engineering Bootcamp]]></title>
            <link>https://medium.com/@cnclause123/from-a-masters-program-to-a-software-engineering-bootcamp-5bbb5bc47c2f?source=rss-e8538c8a633e------2</link>
            <guid isPermaLink="false">https://medium.com/p/5bbb5bc47c2f</guid>
            <category><![CDATA[education]]></category>
            <dc:creator><![CDATA[Catherine Clause]]></dc:creator>
            <pubDate>Tue, 29 Oct 2019 23:43:59 GMT</pubDate>
            <atom:updated>2019-10-29T23:43:59.352Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*F5wzZvQXtNo4EiUN" /><figcaption>Photo by <a href="https://unsplash.com/@goian?utm_source=medium&amp;utm_medium=referral">Ian Schneider</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>If someone told me three and a half years ago, on my graduation day from college, that I would leave the liberal arts field to enter software engineering…I wouldn’t believe them. I was set on entering a field where I knew that the work I was doing was giving me a chance to positively impact this world. I even had that job, but craving more individual growth, I entered into an MPA program.</p><p>Last year was my first year in the program, and I had moments where I loved it. But I found that the moments where I didn’t enjoy it far outweighed the ones where I did. I began questioning not only the program, but education as a whole. I realized that I wasn’t learning. It felt stagnant. The longer I stayed in academia, the more I noticed that the teaching methods of being talked at and powerpoints, weren’t getting me anywhere. I was extremely disappointed to find that the master’s program was just more of the same. I didn’t enjoy going to class, the readings, or the assignments. I held the narrative that becoming a public administrator would set me up in a career path where I could positively impact communities.This past summer, I realized that getting an MPA wasn’t going to do that for me. It felt like I was learning how to be a part of the system instead of how I could impact it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*qqndoqBFQ0_W0ZGLAnN7OA.jpeg" /><figcaption><a href="http://www.asbmb.org/assets/0/366/418/428/964/966/972/1d9d8179-c98f-4c02-b6f7-41c1fb9b208f.jpg">http://www.asbmb.org/assets/0/366/418/428/964/966/972/1d9d8179-c98f-4c02-b6f7-41c1fb9b208f.jpg</a></figcaption></figure><p>As I began discussing this with more and more people, the universe kept whispering coding bootcamps into my ear. It seemed people were always talking about it. I decided to take that as a sign and venture into some free classes. Before I knew it, I was glued to my computer screen, sitting at my desk for hours at a time, and enjoying it. I had this epiphany, that I didn’t have to follow a ‘traditional’ path in order to give back to the world. I saw the power in coding. I saw the opportunity to dive into my passion.</p><p>Now I am nine weeks in, and I can’t believe how much I have learned and how in love with coding I became. I feel my brain is expanding from the information I am retaining. It is a learning environment that is exhausting, yes, but one that you are continuously growing from. My favorite thing about software engineering and learning new technologies, is that it has felt like the more I learn, the more I realize how much there is<strong> to</strong> learn. There is always a new technology, a new way to write code, or a new idea, it is endless. It has created space for my creativity, and given me a craft to implement my ideas. This experience, so far, has been empowering. It has showed me that I don’t need to follow societal standards to learn or be successful. It has given me the power to take education and learning in my own hands. And that is a lesson that I hope to carry with me as I continue my journey in software engineering.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5bbb5bc47c2f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting up an API: Let’s get ready to fetch!]]></title>
            <link>https://medium.com/@cnclause123/setting-up-an-api-lets-get-ready-to-fetch-c245f9bf5094?source=rss-e8538c8a633e------2</link>
            <guid isPermaLink="false">https://medium.com/p/c245f9bf5094</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[flatiron-school]]></category>
            <dc:creator><![CDATA[Catherine Clause]]></dc:creator>
            <pubDate>Mon, 07 Oct 2019 22:21:42 GMT</pubDate>
            <atom:updated>2019-10-07T22:22:50.560Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Setting up an API: Ruby on Rails</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*u4eD8ZZfDYnkljR_" /><figcaption>Photo by <a href="https://unsplash.com/@tvick?utm_source=medium&amp;utm_medium=referral">Taylor Vick</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Six weeks down and nine weeks to go. I just completed my second module at Flatiron School. These passed three weeks have been filled with ruby on rails and javascript. One of the biggest tools we have learned, is how to create an API.</p><p>This blog is going to go through a “how-to” set up an API using Ruby on Rails.</p><p>Below is a visual representation of what is happening in Rails when there is an HTTP request. The HTTP request is sent to the router. The router holds the methods and paths that a request can make. Based on the request it will follow the correct path to the controller. The controller holds different actions. The router will point to a certain action in the controller. Once the request hits the action, then it is sent to the model and the model interacts with the database. The information from the database is sent back to the model, and the model sends it back to the action. That action then renders the response and sends it back out for the HTTP response. Confusing? Don’t worry! We are going to build this together.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*ZzuJ-yqsTJmiPG9UOLsMww.jpeg" /></figure><p>Let’s go!</p><p><em>For the purpose of this blog and being able to follow along, we will create a beer API.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AvLrCLyHJF9sfCVC" /><figcaption>Photo by <a href="https://unsplash.com/@wilstewart3?utm_source=medium&amp;utm_medium=referral">Wil Stewart</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><ol><li>In whichever folder you would like to create your API directory, run: rails new document_name_api --api in your terminal. You will see that an API directory is being created! cd into your API and check out the different folders that were created.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/446/1*Kx7lqjzZjNKkmzXObc9Kfw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/370/1*10EdN_YTx4rxYWulGzULkw.png" /></figure><p>2. Let’s create our models!</p><p>If you have used Ruby but haven’t started adventuring into Rails, it is good to know that a Rails Model is a Ruby class. It is important to remember that model names should be <strong>singular. </strong>Pluralization matters in Rails!</p><p>To create a model we can use the rails generate or rails g command on the command line. This will also set up our table for the database. Following this command will be the name of our model and any data we want our table to hold.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zMGu82zGccT5fsdt5wiC4A.png" /></figure><p>rails g model beer name alcohol_percentage:integer brewery</p><p>Let’s break this down:</p><p>rails g model creates our model and table.</p><p>beer is the name of our model (notice it is singular).</p><p>name alocohol_percentage:integer brewery is setting up our table to take in a name (a string), alcohol_percetage(integer), and brewery (a string). These will be the columns on our table.</p><p>String is the default data type for Rails so you do not have to specify that, but notice how we specified integer for alcohol_percetage. The above is the same as writing:</p><p>rails g model beer name:string alcohol_percentage:integer brewery:string</p><p>3. Time to migrate!</p><p>rails db:migrate will migrate our table with the Active Record and update our database with the new table information. This is when our schema gets created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sPM4NPrvSVt0QdRM-3XaYg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5svp43ZVP7x41_FPeVh_7A.png" /></figure><p>After our table(s) have been migrated, we can now set up our controllers and routes. Controllers coordinate the interaction between the user and the models. The routes will lead the HTTP request to the correct controller. Let’s set it up so that if we run our rails server we will be able to view all the different beers in the database.</p><p>4. Setting up our seeds</p><p>In our seeds file we can create a few beers so that when we do try to view all our beers, there will be information in the database.</p><p>The seeds file is located in db/seeds.rb</p><p>To create a beer we can use the .create method.</p><p>Before we create the beers, make sure to put Beer.destroy_all at the top of the seeds file. This is good practice, so that every time you may re-seed you do not have duplicates in your database.</p><p>Let’s create three beers: Yuengling Lager, Sierra Nevada Pale Ale, Great Divide Farmhouse Ale</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DDRnJfkHyaAKc7Y6BI8AhA.png" /></figure><p>After the beers are created in our seeds.rb folder we can run rails db:seed to seed our database.</p><p><em>If nothing happens after you run the command, that is good!</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*zK7dPsk3yVUiZRJrlFeYBw.png" /></figure><p>5. Creating a controller</p><p>To create a controller we are going to use rails g controller followed by the name of our controller. The name of the controller is typically the same name as your model except it is <strong>plural.</strong></p><p>We will run rails g controller beers</p><p>The created controller can be found :app/controllers/beers_controller.rb</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rFxMzztvPdn1JT2T0oDwwg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/362/1*id5G1GSJ2DFHL3ZTIFfrDg.png" /></figure><p>The method that needs to be created to show all the beers in our database is the index action.</p><p>It will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*znh6ZeJHqXajIa6_UfAXkg.png" /></figure><p>When the index action is called, we want to create a class variable @beers and set it equal to Beer.all . We then render json: @beers . What render json: does is say what we want our response to show when we call the action. Since we want it to show our beers, we render json: @beers.</p><p>6. Creating routes</p><p>Once our controller is set up we can go into our routes folder in config/routes.rb .</p><p>Our route set up will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UV6cH6qtmc-w0bcL769wcg.png" /></figure><p>resources &quot;beers&quot; is saying that if we have a request /beers to run the action associated with that request.</p><p>The action in this case is index. The reason we have only: [:index] , is because there are more actions that can be called, but since we only have our index method set up we are not able to support any other requests.</p><p><em>Side note:</em><em> index is an action that is based off of REST (a software architecture style). The method associated with </em><em>index is </em><em>get. A few other common methods and their actions are post (action: create), put/patch(action: update), and delete (action: destroy).</em></p><p>6. Lets run it!</p><p>To check the request, we can run rails s and in your browser go to <a href="http://localhost:3000/beers">http://localhost:3000/beers</a> .</p><p>All the beers we created should be rendering on the screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*1rF159R6z9ZcMV-vme_UTg.png" /></figure><p>You have just set up and rendered data from an API!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9GYeE94MMcDVj0gU" /><figcaption>Photo by <a href="https://unsplash.com/@mertguller?utm_source=medium&amp;utm_medium=referral">Mert Guller</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c245f9bf5094" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deleting an Entire User Instance in Ruby]]></title>
            <link>https://medium.com/@cnclause123/deleting-an-entire-user-instance-in-ruby-d3127bdb5160?source=rss-e8538c8a633e------2</link>
            <guid isPermaLink="false">https://medium.com/p/d3127bdb5160</guid>
            <category><![CDATA[flatiron-school]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Catherine Clause]]></dc:creator>
            <pubDate>Mon, 16 Sep 2019 23:37:05 GMT</pubDate>
            <atom:updated>2019-09-16T23:45:44.958Z</atom:updated>
            <content:encoded><![CDATA[<h3>Deleting an Entire Class Instance in Ruby</h3><p>What this blog will address:</p><ol><li>Classes: Many to Many Relationships</li><li>Join Table</li><li>Deleting an Instance</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oPnKptnfoNvzwTn8" /><figcaption>Photo by <a href="https://unsplash.com/@cdr6934?utm_source=medium&amp;utm_medium=referral">Chris Ried</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I was three weeks deep in my intensive software engineering program at Flatiron. I had just finished learning Ruby and it was then time to partner up and create a CLI (command-line interface) app using it. My partner and I decided to have some fun with this project and use a DnD (Dungeon and Dragons) open API to create a short, but awesome, adventure game.</p><p><em>— if you want to play, check it out </em><a href="http://cnclause/module-one-final-project-guidelines-denver-web-82619"><em>here</em></a><em> —</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mKFMXz4oVSZ8aI1D" /><figcaption>Photo by <a href="https://unsplash.com/@mostafa_meraji?utm_source=medium&amp;utm_medium=referral">mostafa meraji</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This was our time to put our knowledge about many to many class relationships to the test! We were using Sinatra and ActiveRecord, so creating the tables was the easy part. The harder part for us, and fellow classmates, was deleting a user instance. What was difficult was deleting not only the user but, in this case, the weapons associated with that specific user. To make this easier to follow along, check out our join table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*94_OEgstmB7OSc_Q" /></figure><p>For example, our app saved the username of anyone who played. So if we wanted to let a user completely delete their user instance and therefore the weapons they had in the game, how would we do that if we were just given the username?</p><p>Well, let’s break it down!</p><p><strong>Finder Method:</strong></p><pre>.find_by()</pre><p>Here is an example of a user instance returned using .find_by:</p><pre>User.find_by(name:&quot;Damon&quot;) </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NfjQ1iM8YBBhNYKp7sUFlQ.png" /><figcaption>User instance</figcaption></figure><p>Using .find_by method to find the id of the user</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*ouyFanbfsup3lfVQZd_Oig.png" /><figcaption><em>In the example above the username was not assigned to a variable but it is the same method.</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/142/1*4bKcTt2m_OpgrOZu0dSasQ.png" /><figcaption>This is the returned value</figcaption></figure><p><em>If you wanted to set the method above to a variable it would look like:</em></p><pre>variable = User.find_by(name:&quot;Damon&quot;).id</pre><p>This line of code is using a finder method on the class “User”. The .find_by method takes in a specified condition and returns the first instance that matches that condition. We attached .id<em> </em>to the end of our finder method to pull the id that is attached to the user with that specified username. We then set a variable equal to this method so that it is easily accessible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*o1N-GrcA3F_o0TuoEshyWA.png" /><figcaption><em>In the code above, it is important to note that within the “</em><em>.find_by(name:</em><strong><em> delete</em></strong><em>)”, delete is referring to a variable. The user was prompted to select an option when they entered the delete menu. One was selecting the username they wanted to delete. That username was set to equal the variable </em><strong><em>delete</em></strong><em>.</em></figcaption></figure><p><strong>Using a class id to access an instance in the join table:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VxjZy3LEdmmaVTBAoTMD7Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/150/1*Wr6NvfN3Jjuvq_KF9MWmQA.png" /><figcaption>The returned value</figcaption></figure><p>Once we had the user id we wanted to delete, we used that variable (delete_id) to find that instance on the join table (Userweapon). We then added .weapon_id<em> </em>to the end to retrieve the weapon_id that is a part of that instance. We did this because since a user can have many weapons, we want to not only be able to delete a user instance but also the weapons that that user had in their inventory from playing the game.</p><p><strong>**This is where the user and the weapons that user collected in the game were connected**</strong></p><p>We set that equal to a variable to that it would be easily accessible in future steps.</p><p><strong>Deleting users: .destroy</strong></p><p>After the id’s of the user and weapon were found, then it was time to delete (or destroy) those instances.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*Wp4-eaVd_RyfTIjuAol9NQ.png" /></figure><p>Remember the delete_id variable holds the value of the user id we wanted to delete.</p><p>So we used the .find_by method and found the Userweapon instance that held that user_id value. We added .destroy to the end in order to delete the entire instance.</p><p>We repeated this step within the User class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*57Nd2rXJlsINsE7fEEdVog.png" /></figure><p>Remember the <strong>weaponid </strong>variable that was set above? This is when that variable will come in handy! We plugged that variable into the .find_by method. This allowed us to pull out that specific weapon instance that was associated with the username that was chosen to be deleted. We added .destroy to the end of the method in order to delete that entire instance, as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*kpS-CTW6YgEVPjOEd-7sng.png" /></figure><p>Final code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fdyfNf6VClddD6ei3xXf0w.png" /></figure><h3><strong>Take Aways</strong></h3><p>What helped us solve this issues was using the wonders of binding.pry and seeing what was returning when we ran these methods. Additionally, setting variables for the methods that found specified instances was helpful when needing to access those methods in future code.</p><p>I would recommend using better variable names than we did, and I hope our lack of representative names didn’t make this more confusing.</p><p>Enjoy deleting!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d3127bdb5160" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>