<?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 Jenny Kim on Medium]]></title>
        <description><![CDATA[Stories by Jenny Kim on Medium]]></description>
        <link>https://medium.com/@kim-jenny5?source=rss-3c90ba9aa890------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*p0qk4ZEuZXiN19U4NPa-lw.png</url>
            <title>Stories by Jenny Kim on Medium</title>
            <link>https://medium.com/@kim-jenny5?source=rss-3c90ba9aa890------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 12:32:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kim-jenny5/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[How I set up JWT with Rails API and React]]></title>
            <link>https://blog.devgenius.io/how-i-set-up-jwt-with-rails-api-and-react-3caec9b00482?source=rss-3c90ba9aa890------2</link>
            <guid isPermaLink="false">https://medium.com/p/3caec9b00482</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[jwt]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[rails-api]]></category>
            <category><![CDATA[rails]]></category>
            <dc:creator><![CDATA[Jenny Kim]]></dc:creator>
            <pubDate>Tue, 21 Dec 2021 22:47:14 GMT</pubDate>
            <atom:updated>2022-02-04T21:52:37.241Z</atom:updated>
            <content:encoded><![CDATA[<p>For my final project at the Flatiron School, I decided to create a web application that could securely log in its users using JWT. Before I graduated from Bootcamp, I wanted to test my skills in configuring user authentication on the client-side, since a good app is a secure app.</p><p>For the most part, I received a lot of help from a couple of different articles (all of which are linked down at the end), but of course, I had to make sense of the logic myself, which was a frustrating moment on its own. 😵‍💫</p><h3>Backend Setup</h3><p>I first created my Rails API project using the API flag and specifying my database system by typing into my terminal:</p><p>rails new project-name-here --api --database=postgresql</p><p>By specifying that I want postgreSQL for my database, this makes deploying later onto Heroku easier and is actually better for your application if your development and production use the same database system.</p><p>The next steps were naturally then to push the newly created app to my GitHub and add the necessary gems to the gemfile.</p><h4>Gems 💎</h4><p>The relevant gems I used for setting up JWT were pg, bcrpyt, jwt, and active_model_serializers.</p><p>After running bundle in the terminal, I was ready to start the nitty-gritty.</p><h4>Models 💁🏻‍♀️</h4><p>For this specific project, I created three models: User, Trips, and Places. In terms of how they were associated with one another:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*REKptF00f_OhOYlv829-Sw.jpeg" /></figure><p>To generate these models, I typed into the terminal (exemplifying with the User model):</p><pre>rails g resource User first_name last_name email password_digest --no-test-framework --skip-template-engine</pre><p>--skip-template-engine was purely added to make sure no view folder/files were created and password_digest was included because we’re using bcrypt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DwlJki85ZaCp3ZqRo9nCaw.png" /><figcaption>User model</figcaption></figure><p>As you can see from above, we do not need to validate the password since has_secure_password from bcrypt will take care of that for us.</p><h4>Controllers 🕹</h4><p>The three controllers that we’ll need to pay attention to are:</p><ol><li>application_controller</li><li>users_controller</li><li>sessions_controller</li></ol><p>Let’s first tackle the <strong>application_controller</strong>, since this one is a bit of a doozy.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/53b7bded3adbbbb98fb777662be67415/href">https://medium.com/media/53b7bded3adbbbb98fb777662be67415/href</a></iframe><p>This is a lot to unpack — I know. We’ll start with the first method: jwt_key.</p><p>In order to utilize Rails.application.credentials.jwt_key, we’ll need to first create and hide our secret key.</p><ol><li><strong>Create 256-bit secret key, using </strong><strong>openssl</strong></li></ol><p>In your terminal type: openssl rand -base64 32.</p><p>This will output a random 32-bytes/256-bit jumble of letters and characters. Hold onto this key because now we have to hide it somewhere within our application files.</p><p>2. Hiding the key</p><p>Type into your terminal: EDITOR=&quot;code --wait&quot; rails credentials:edit</p><p>This will open a file in your VS Code in which you can store the secret key.</p><p>3. Add the key to the file</p><p>Add the following hash: jwt_key: 256-bit-secret-key-here-instead-of-this and save and exit out of that file.</p><p>Now that we’ve created our secret key and have saved it away, we can proceed to the other controllers. I won’t go too much into detail regarding application_controller&#39;s other methods, but to truly understand what they’re doing behind the scenes, feel free to play around with your code in the console or Google around to master the concept! 🤓</p><p>With that, let’s move onto the <strong>users_controller</strong>. As a reminder, the difference between users_controller and sessions_controller is <em>new</em> users will be directed to the create the method in the former and <em>returning</em> users will be directed to the create the method in the latter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jdkS2mk7NA_9EMLqPIptoQ.png" /><figcaption>users_controller create method</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j5YPATn6lEWS07JxfWvoXw.png" /><figcaption>users_controller user_params</figcaption></figure><p>issue_token on line 12 comes from the application_controller and UserSerializer from line 13 comes from the active_model_serializers gem that I had added earlier on.</p><p>This is pretty self-explanatory, so I’ll move onto the next controller for JWT setup, which is <strong>sessions_controller</strong>, which I likewise won’t go too much into detail since the code itself is self-explanatory as well.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6f8e305c56b4509c4598fb6343124023/href">https://medium.com/media/6f8e305c56b4509c4598fb6343124023/href</a></iframe><p>The create method is used for logging in the user while the show method is used to determine whether the user is already logged in or not. And as a reminder, user.authenticate comes from bcrypt.</p><h4>Routes 🛣</h4><p>With our models and the important controllers set up, we can move to our routes in our routes.rb file. The way I’ve set up the URLs for my project are like so:</p><pre>post &quot;/signup&quot;, to: &quot;users#create&quot;<br>post &quot;/login&quot;, to: &quot;sessions#create&quot;<br>get &quot;/authorized&quot;, to: &quot;sessions#show&quot;<br>get &quot;/dashboard&quot;, to: &quot;users#show&quot;</pre><p>With that, we are pretty much done with our backend so let’s move onto our frontend!</p><h3>Frontend Setup</h3><p>Frontend setup is unfortunately not as straightforward as its backend counterpart, since everyone’s frontend architecture would be slightly different, but for the most part, it involves utilizing localStorage.</p><h4>localStorage.setItem()</h4><p>Now that we’ve generated a JWT on the backend, how do we make our frontend cognizant of that JWT? For my project, I’ve set this up in my logInUser action creator, but you may place this logic anywhere else you see fit in your own project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_dljZlwBZpdu0zlGDlY_mg.png" /><figcaption>logInUser action creator</figcaption></figure><p>Important note❗️ Because we set up in our backend that our headers should include an Authorization object (from line 20 in the application_controller), we must include Authorization: localStorage.token on line 33 above.</p><p>As you can see from lines 44 and 45, we’re taking the user and token object that we received back from logging in a user and essentially saving it to our localStorage.</p><p>We need to utilize localStorage because every time the application refreshes, the state does not persist, meaning the token in the app’s state will be cleaned out. Therefore, to make sure our app realizes that a user is really logged in, we must be able to save the token initially generated from the login and save it to our localStorage, so our app now knows to look at the browser’s localStorage to see if indeed a token exists, ergo if a user is logged in or not.</p><p>I know that sounded very complicated, so by all means take a couple seconds to read it over.</p><h4>localStorage.getItem()</h4><p>Now that we’ve set the user and token objects in our localStorage, we’ve got to <em>get</em> the objects from the storage in order to use the data.</p><p>For my project, I wanted the app to check if the user and token objects existed in localStorage upon starting up. Therefore, I added the following code in my componentDidMount() method in my App component.</p><pre><em>let</em> token = localStorage.getItem(&quot;token&quot;);<br><em>let</em> user = localStorage.getItem(&quot;user&quot;);</pre><pre>if (token &amp;&amp; user) {<br>   this.props.fetchCurrentUser();<br>}</pre><p>For further details and to see the whole code, be sure to check out this project’s frontend <a href="https://github.com/kim-jenny5/my-travelogue-frontend">GitHub</a>.</p><h4>localStorage.removeItem()</h4><p>Just as setting up and getting the tokens are important, make sure to include code to remove the objects from localStorage.</p><p>I’ve included my localStorage.removeItem() lines of code in two different components — one that works as a fail-safe when an error occurs and the other for when a user logs out.</p><p>Primarily for your application, you’ll just be wanting to add the following lines of code for when your user clicks the logout button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*dPynrmE8aahSFeccgqpI7A.png" /></figure><p>As you can see from above, once a user clicks the button to log out, that’ll trigger this function which removes both user and token objects from localStorage and dispatches an action to the logOutUser() action creator.</p><p>All in all, this is the general gist on how to set up your application secure with JWT. I tried to go in-depth as much as possible, but if I were to detail every single line, this article would be much longer (and much more 🤯 than it already is).</p><p>I strongly recommend to take a look at my GitHub repos for the backend and frontend to make sense of the entire code flow, as well as the three articles I linked down below, as each one helped me through my personal challenge of creating a secure app. I hope this helped and hopefully your process goes smoothly! 😊</p><h3>Resources</h3><h4>My GitHub repos for this project</h4><ul><li><a href="https://github.com/kim-jenny5/my-travelogue-backend">Backend</a></li><li><a href="https://github.com/kim-jenny5/my-travelogue-frontend">Frontend</a></li></ul><h4>Articles that helped me</h4><ul><li><a href="https://dev.to/evanrpavone/setting-up-jwt-in-rails-api-backend-for-react-frontend-9d8">https://dev.to/evanrpavone/setting-up-jwt-in-rails-api-backend-for-react-frontend-9d8</a></li><li><a href="https://dev.to/kahawaiikailana/rails-api-quickstart-guide-with-postgressql-and-jwt-tokens-3pnk">https://dev.to/kahawaiikailana/rails-api-quickstart-guide-with-postgressql-and-jwt-tokens-3pnk</a></li><li><a href="https://medium.com/swlh/the-client-side-authentication-system-using-jwt-token-on-my-rails-react-app-65d4760be3d">https://medium.com/swlh/the-client-side-authentication-system-using-jwt-token-on-my-rails-react-app-65d4760be3d</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3caec9b00482" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/how-i-set-up-jwt-with-rails-api-and-react-3caec9b00482">How I set up JWT with Rails API and React</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My journey and approach to beginning a new project]]></title>
            <link>https://kim-jenny5.medium.com/my-journey-and-approach-to-beginning-a-new-project-f4add3ca791e?source=rss-3c90ba9aa890------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4add3ca791e</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[flatiron-school]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Jenny Kim]]></dc:creator>
            <pubDate>Mon, 13 Dec 2021 23:31:14 GMT</pubDate>
            <atom:updated>2021-12-13T23:31:14.199Z</atom:updated>
            <content:encoded><![CDATA[<p>I’m in my final weeks of coding bootcamp at the Flatiron School — applauses all around for me 🥳 — and undoubtedly enrolling at Flatiron was one of my best decisions. I could not be more grateful for it having provided me this smooth transition into the tech world, as an introduction to programming could very well be overwhelming with all its different languages, libraries, frameworks, and more.</p><p>When I was a high school senior taking AP Computer Science, I looked at software engineering job posts to understand what I’d need to learn and know for my potential future. I was completely and utterly turned off by the posts’ complicated tech jargon and I prematurely decided that programming was “not for me,” proceeding to apply to colleges as a business major.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*T9RK1hDFs8F0JDY9.jpg" /></figure><p>Needless to say, I found myself back to coding and as I reflect back on my overall programming journey, I wanted to similarly reflect on my last project at Flatiron. In general, I think the beginnings of any new thing (a new school year, a new chapter of your life, a new project, etc.) are the most important as they lay down the foundation. So I believe that before going into it, one needs a clear and organized frame of mind. With this said, I’m all about organization, which I try to apply to almost all aspects of my life, and after having finished a total of five projects at Flatiron, I am glad to report that I’ve (somewhat) streamlined my approach to beginning new applications/projects, which I believe as a job candidate will help me shine and later as an employee help strengthen my planning and organization for new projects at the workplace.</p><h4>So, what does my process look like?</h4><ol><li>Create a model associations chart to visually see how each of my backend models connect with one another.</li></ol><p>Including the time to devise my overall idea and how each model and its attributes play a role in my project, this step takes about a day.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*REKptF00f_OhOYlv829-Sw.jpeg" /></figure><p>2. Create a preliminary flow chart to visually see how the user will interact with the application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*f5NotUXdQERltvb_1y3MaA.jpeg" /></figure><p>For this particular project, we were tasked to create at least 3 client-side routes, of which mine were the login, signup, and dashboard pages. I was having an incredibly difficult time with react-router 😰 and my application continued to break when I tried to add in additional routes. Although I’d already fulfilled my project’s requirements, I wanted to include the features I’d had come up with and therefore, I decided to work with modals for the first time (using MUI).</p><p>3. Design a wireframe on Figma to visually plan and imagine my end product.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.figma.com%2Fembed%3Fembed_host%3Doembed%26url%3Dhttps%3A%2F%2Fwww.figma.com%2Ffile%2F67VF6XgZjFXI76jku75b1R%2FPhase-5-Project-Wireframing%3Fnode-id%3D0%253A1&amp;display_name=Figma&amp;url=https%3A%2F%2Fwww.figma.com%2Ffile%2F67VF6XgZjFXI76jku75b1R%2FPhase-5-Project-Wireframing%3Fnode-id%3D0%253A1&amp;image=https%3A%2F%2Fapi-cdn.figma.com%2Fresize%2Fthumbnails%2F108dbd09-6615-462c-87f9-973856af3672%3Fheight%3D144%26bucket%3Dfigma-alpha&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=figma" width="800" height="450" frameborder="0" scrolling="no"><a href="https://medium.com/media/32e5b2f7f44f68c304bd94ccc8eb3bed/href">https://medium.com/media/32e5b2f7f44f68c304bd94ccc8eb3bed/href</a></iframe><p>During this step, I surf through Dribbble and Behance for inspiration, draw up some barebones low-fidelity wireframes on scratch paper and then proceed to creating a high-fidelity wireframe for my application on Figma, along with devising the color palette and typography. Overall, this takes about two days for me to complete.</p><p>As I design and code a product from start to finish, this step is the most crucial for me, as it helps me to see what features are doable in my timeframe and what I’ll need to include in my application. Towards the end when I add in CSS and stylize my components, this Figma file is my ultimate reference, which greatly speeds up the designing process.</p><p>While many of my classmates may not add much CSS to their applications, everyone’s priorities are different, as some may focus more on the backend capabilities, but as an aspiring front-end developer, with a strong interest in UI design, I don’t like to skimp on this part of my process. I find incredible pride and joy in being able to code my application the way I’ve imagined and designed it.</p><p>4. Start coding! Backend first, with frontend later.</p><p>This step, being the heart of my application, takes me the rest of the time I have for the project, which on average is about 10–11 days. For this project, since we had learned React most recently, I allotted more time to focus on my frontend code than my backend, which I probably only spent a day or two on.</p><p>With my planning and organization process discussed, I feel it pertinent to also admit that not everything went to plan. This is of course inescapable. The end design and features of my application stayed mostly true to my planning, but of course I had to make changes along the way as I continued to run into issues. These issues ranged from lacking enough time to lacking the patience with all the debugging, resulting in me having to cut down on some of the ambitious features I initially wanted to include, such as fetching from Google Maps/Places API, configuring Active Storage and AWS so users could hypothetically upload pictures from their trips, etc.</p><p>However, of all the issues I had with this project, I’d say the most notable was that of <strong>routes</strong>. Oh boy. Since I had configured user authentication, complete with the bcrypyt gem and JWT on the backend, it was extremely difficult with my current set of knowledge and time to solve the issue of preventing users from accessing certain pages if they were not logged in. I spent roughly three days trying configure more than the three required routes, but ultimately resorted to using modals instead, as I’d previously mentioned.</p><p>I had initially tried to add &lt;Route /&gt; statements across different components, so that private routes were only available in the private components (ones that were only accessible after the user logged in) but I quickly realized that my approach to this was incorrect and faulty. Instead, I decided to list all the routes in the mainApp component, like I should have from the beginning, and then render the correct component, depending on the path URL the user was on via the UserContainer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*St9cf4qj3rUntl6tvSJF4Q.png" /><figcaption>App component</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/483/1*hBKiQta1HsxtTqaiVQO8Gw.png" /><figcaption>UserContainer component</figcaption></figure><p>With this, if the user was on the URL of “/login,” then the Login component would render. If the user was logged in, then they’d see the DashboardContainer component and if they were not logged in at all, they’d be redirected to the login page.</p><p>While I’m not confident that this is the correct method to go about separating components and routes for logged in users and for those who are not, this method ultimately worked and as the saying goes: if it ain’t broke, don’t fix it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/0*TRqy7h9HHajQixNv" /></figure><p>Of course, this just means I have further learning to do even after I graduate from bootcamp, but I must say given my current set of knowledge and time I was provided, I am quite proud of the application I built and I really do look forward to all the possibilities with coding as I continue to my programming journey.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4add3ca791e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to: Active Storage with a Rails API and JavaScript Frontend, with Amazon S3]]></title>
            <link>https://kim-jenny5.medium.com/how-to-active-storage-with-a-rails-api-and-javascript-frontend-with-amazon-s3-9d1e0045d3bc?source=rss-3c90ba9aa890------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d1e0045d3bc</guid>
            <category><![CDATA[rails]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[active-storage]]></category>
            <dc:creator><![CDATA[Jenny Kim]]></dc:creator>
            <pubDate>Sun, 10 Oct 2021 20:29:56 GMT</pubDate>
            <atom:updated>2021-10-10T20:29:56.786Z</atom:updated>
            <content:encoded><![CDATA[<p>For those looking to configure Active Storage with a Rails API as your backend and Javascript as your frontend, fear not — you’ve come to the right place!</p><p>After scouring the internet, looking over the <a href="https://edgeguides.rubyonrails.org/active_storage_overview.html">Active Storage documentation</a> <em>numerous</em> times, and getting lost and confused over the many different methods, I had finally figured out how to get my project and code working. Without Active Storage, my back-up plan was prompting users to copy and paste a URL of the picture they wanted to upload, but why do that when we have Active Storage! 🤩📦</p><p>To give you a quick background on my project and why I wanted/needed Active Storage: I created a picture board SPA (single-page application), similar to VSCO/Tumblr, where users could create “collections,” or albums, and upload photos onto said collections. Overall, my project used <strong>PostgreSQL </strong>for the database (to later make Heroku deployment easier), <strong>Ruby on Rails</strong> for the backend, <strong>JavaScript </strong>for the frontend, <strong>Active Storage</strong> to attach the file uploads to their Active Record objects, and <strong>Amazon S3</strong> as my cloud storage (personally to make showing my project to others easier). Configuring a cloud storage service is optional. You can use local storage in the development stage, but since I used Amazon S3 for both the development and production environment, I’ll be discussing in this article how to set that up as well.</p><h3>Backend Setup</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*3tRqWSUTK8qssKnKH1FmqQ.jpeg" /><figcaption>Diagram of model associations and flow chart</figcaption></figure><p>As you can see, the idea for my backend was kept fairly simple. A user has many collections, which has many pictures, and for each picture <em>object</em>, it has an Active Storage file attached to it.</p><p>Now, let’s get started on the actual set up! First, to create your Active Storage database tables, run:</p><pre>rails active_storage:install</pre><p>Afterwards, you’ll need to migrate your tables:</p><pre>rails db:migrate</pre><p>I personally like to migrate my tables all at once, after I’ve generated my models, so I went ahead and created my <strong>user</strong>, <strong>collection</strong>, and <strong>picture</strong> models, as well as set up their has_many and belongs_to relationships.</p><p>Next, we’re going to set up our Active Storage services. Go to your <strong>config/storage.yml </strong>file and uncomment out test, local, and Amazon.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/722/1*1z33wTvDZHmja96lBbiQ3w.png" /></figure><p>This is what your storage.yml file should look like, except your region and bucket information for Amazon will be different; however, let’s not concern ourselves with S3 just yet.</p><p>Then, you’ll need to tell Active Storage which services you’re using for which environment. So, go to your <strong>config/environments</strong> folder and for each file, locate this line of code:</p><pre>config.active_storage.service</pre><p>In each of your environment file, that line of code above should look like the screenshot from the Active Storage documentation below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*lGwC107rH9jFgz-Yv9ZMtQ.png" /></figure><p>I’ve personally set my service in my development.rb file to Amazon’s, instead of local, and while we’re talking about Amazon, let’s quickly talk about how to get S3 set up.</p><h4>Amazon S3</h4><ol><li>Install this gem in your <strong>gemfile </strong>and run<strong> </strong>bundle in your terminal<strong>.</strong></li></ol><pre>gem &quot;aws-sdk-s3&quot;, require: <strong>false</strong></pre><ol><li>If you haven’t already, <a href="https://aws.amazon.com/premiumsupport/knowledge-center/create-and-activate-aws-account/">create and activate your AWS account</a>.</li><li><a href="https://console.aws.amazon.com/iam/home?#/security_credentials">Grab your S3 credentials</a>, which you’ll need for your access key and secret access key. You may want to download the CSV file onto your computer.</li><li>Create your S3 bucket. The name should pertain to your project and must be unique.</li><li>Now, for the exciting part! We’ll be encrypting our access keys. Run the following code in your terminal:</li></ol><pre>rails credentials:edit</pre><p>This generic piece of code will automatically set the EDITOR environment value to your default editor, but if nothing happens, you should explicitly state your editor. For example, for your editor of choice, you should run:</p><pre>// VS Code<br>EDITOR=&quot;code --wait&quot; rails credentials:edit</pre><pre>// Atom<br>EDITOR=&quot;atom --wait&quot; rails credentials:edit</pre><pre>// Sublime Text<br>EDITOR=&quot;sublime --wait&quot; rails credentials:edit</pre><p>The --wait simply tells the terminal to wait till you’re done inputting your credentials and have closed the file.</p><p>Upon running either one of the codes above, a temporary file will open. Uncomment out the following lines and copy and paste your access keys from Amazon.</p><pre>aws:<br>  access_key_id: 12345<br>  secret_access_key: 12345</pre><p>Once you close the file, it’ll be encrypted and Rails will automatically create a <strong>config/credentials.yml.enc </strong>file. While we don’t need to go into further detail regarding this file, the following information is very important! Make sure your <strong>config/master.key</strong> file, which should’ve been created upon your Rails app creation, is listed in your <strong>.gitignore</strong> file. The master key should NOT be uploaded to Github.</p><p>5. Finally, head back to your <strong>config/storage.yml</strong> file and edit your region and bucket information. Now when your application runs, everything should be connected!</p><p>In case you want to check that your access_key_idand secret_access_keyis indeed pointing to the right values, you can run the following codes in your terminal:</p><pre>Rails.application.credentials.dig(:aws, :access_key_id)</pre><pre>Rails.application.credentials.dig(:aws, :secret_access_key)</pre><p>Now let’s get back to our backend setup!</p><h4>Back to Active Storage on the backend</h4><p>The way Active Storage files attach to their records is through has_one_attached and has_many_attached. For my project, I chose to opt for each picture having just <em>one</em> Active Storage file attached to it. Essentially, a picture is attached to a picture object.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/381/1*TrLLpcPzbOSXtGRodQjLPg.png" /><figcaption>Picture Model</figcaption></figure><p>Starting with my Picture model, I’ve created a custom method called pic_url to handle grabbing the attached picture’s URL from Active Storage. This method should be added as an attribute to your serializer (if you chose to use one), so your application can access this URL for the picture src.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*2trjI2mlHnnmYVPLgqJw0Q.png" /><figcaption>Serializer using Active Model for my backend data</figcaption></figure><p>Trying to figure out how to get the URL of the Active Storage attachment was a doozy. I was initially following the documentation that suggested using url_for, but for my particular project needs this was pointing me towards the wrong direction. In retrospect it seemed as though the answer was right in front of me, but I did wish the documentation had explicitly stated which methods were available for us to use with the Active Storage attachment. Therefore, I suggest you check out all the different methods available by running Picture.img_file.methods and Picture.img_file.attachment.methods in your console for your respective models and Active Storage file(s).</p><p>Once you’ve added the URL attribute to your serializer, you can boot up rails s and go to localhost:3000. If you’ve set up your models and their relationships correctly (as well as seeded data), you should be able to see the URL for each object!</p><h4>Introducing FormData</h4><p>Next, I’ll be discussing FormData which held the key to making file uploads from my frontend properly save to my Rails API in the back. 🗝</p><p>In our Pictures controller, don’t forget to include yourimg_file , or whatever you’ve named the attachment file, into the strict params in your controller. Here, I’ve named my strict params method picture_params and you may note it looks a bit different.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/1*9QNDkFJedlwTeQABUZWQrg.png" /><figcaption>Picture Controller</figcaption></figure><p>Normally, my strict params would include require() and look like this:</p><pre>params.require(:picture).permit(:collection_id, :img_file)</pre><p>Normally, we’d send our form data to our backend as an object with key value pairs, then send it through to our POST request with fetch() as the body by doing JSON.stringify(). However, because we’re sending a <em>file</em>, we need to utilize FormData and send it through as a FormData object. Files can’t be converted to strings and therefore can’t be formatted for JSON. This requires our strict params to be set up a bit differently, like in the above screenshot of my Pictures controller.</p><p>For those who aren’t familiar with FormData, it is <em>not</em> iterable and the data inside FormData can only be accessed a certain way. If you’re debugging and console.logging, only to find that your FormData object is “empty,” don’t panic as your code may have worked — you’re simply accessing the data wrong. I highly suggest you take a look at <a href="https://developer.mozilla.org/en-US/docs/Web/API/FormData">MDN’s documentation on </a><a href="https://developer.mozilla.org/en-US/docs/Web/API/FormData">FormData</a> to check out the different methods to access the data.</p><p>With this, let’s move onto our frontend setup, where I’ll continue to talk about FormData more in depth.</p><h3>Frontend Setup</h3><p>I needed a way for my picture upload form to be created dynamically for each collection upon click, so that the this keyword was pointing to the correct collection object. Therefore, I created a method (createAddBtn()) to create a new picture form each time a collection was accessed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*_MGvUODuwDHHi0TUzLIMVA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*bST9T94dNzcYj0QKKNFddQ.png" /><figcaption>Picture upload form (left), in the form of a “plus” button</figcaption></figure><p>The code you should be primarily looking at are lines 123–130. I’ve extracted the important pieces of code from those lines down below:</p><pre>&lt;input <em>type</em>=&quot;file&quot; <em>name</em>=&quot;img_file&quot; <em>multiple</em>/&gt;</pre><p>The multiple will allow users to upload multiple files at once. Simply remove this if you only want users to upload one file.</p><p>The name of this input element should point to what key you want in your strong params. Since I’ve named my attachment file in my params img_file, I’ve done the same with my input element.</p><p>The next important piece of information you should know about FormData is that you have to access the files from the input element through .files. If there are multiple files, you can access them by iterating through them or calling .files[i]. Take a look at the screenshot down below to get an example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*KzbKRBOOFm3FOMxJbrfH6g.png" /></figure><p>I’ve selected the input element from the DOM on line 135 and added an event listener to it. My “form” only consisted of an upload button, which is why I personally set myaddEventListener to fire on change instead of submit. Since users can upload multiple pictures at once for my application, I’m iterating through input.files on line 138.</p><p>Then I created a new FormData object on line 139 and appended the key value pairs afterwards, ultimately submitting the newly created formData object to a POST request with fetch on the last line, through the uploadPictures() method. To read up on creating FormData objects more in depth, you should follow <a href="https://developer.mozilla.org/en-US/docs/Web/API/FormData/Using_FormData_Objects">this guide</a> on MDN.</p><p>And now that we’ve sent our formData object to our uploadPictures() method, let’s talk about the difference between sending a FormData object and a regular object to a POST request with fetch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/391/1*MXSLx16AXXUgFn94ihrlWQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/403/1*vLpHKTUGYV3PdlfkadwM1Q.png" /><figcaption>The difference between the two POST requests: Pictures using FormData (left), Collections using JSON (right)</figcaption></figure><p>The left screenshotPOSTs a FormData object and the right a regular Collections object with JSON. As you can see, the body of our configObj on the left is our formData object from the previous input form, where we created said formData object on line 139. Comparatively, we are using JSON.stringify() for our body of our configObj on the right. You may also note that the left screenshot excludes headers.</p><p>Once again, this is because our collection object, created on line 21 (on the right screenshot), only contains strings and therefore can be formatted for JSON, whereas FormData objects cannot.</p><p>With that, congratulations! 🥳 You’ve reached the end of setting up Active Storage for a Rails API as a backend and JavaScript for frontend, and if you’ve followed the instructions for setting up Amazon S3, you’ve got that accomplished as well!</p><p>My biggest takeaway from this project is that I shouldn’t solely rely on documentations to help me out with obstacles that pertained specifically to my project. I thought that since documentations are the official standards, I’d only need to follow these instructions to get my program to work. Ultimately, I’d had been chasing the wrong rabbit with trying to get my application to work with Direct Upload, which I much later realized was not what I was looking for for my project, since I didn’t want my picture uploads to bypass my backend server and directly save onto the cloud.</p><p>What’s important to realize is that since your project will undoubtedly be/look different from mine, you may need to program things a bit differently and perhaps in different orders, but for the most part, I hope this article helps you save all the hours I will never get back. 🥲</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d1e0045d3bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When you finally find the career field for you]]></title>
            <link>https://kim-jenny5.medium.com/when-you-finally-find-the-career-field-for-you-15179f81c7dd?source=rss-3c90ba9aa890------2</link>
            <guid isPermaLink="false">https://medium.com/p/15179f81c7dd</guid>
            <category><![CDATA[flatiron-school]]></category>
            <category><![CDATA[figma]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[wireframe]]></category>
            <dc:creator><![CDATA[Jenny Kim]]></dc:creator>
            <pubDate>Sat, 14 Aug 2021 04:11:44 GMT</pubDate>
            <atom:updated>2021-08-14T04:13:20.769Z</atom:updated>
            <content:encoded><![CDATA[<p>My boyfriend’s in his last year of dental school and despite his obviously tired expressions and complaints about his sore muscles, there’s a trace of enthusiasm and passion that shines through his face and voice when he prattles on and on to me about that day’s procedures and treatments. Listening to him talk about his career fervently, I’d wondered, “would I ever find a career that invokes those same emotions in me?”</p><p>As a child, I performed well in school and won multiple music auditions and competitions with my clarinet. The world seemed to be my oyster and the possibilities of my future looked limitless. Yet, I found myself graduating with a Business Administration degree to pursue human resources, with little to no interest in the actual subject. Even up till the very end of my senior year, I continued to ponder the decisions I’d made for my career.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*C3j2TuXCgWZ7-Ypi" /><figcaption>Toby from The Office preachin’</figcaption></figure><p>Fast forward to today, I’m already in my sixth month of Flatiron’s Software Engineering bootcamp (which I’m thoroughly enjoying), and while I do still have doubts about my career (e.g. the ever so cliche “will I ever get a job” question), I feel more comfortable and stable with my tech career prospects.</p><p>Without a doubt programming is every bit as confusing and difficult as people perceive it to be, but the process of going from utterly confused to creating an entire project on your own is in itself thrilling and completely rewarding. As my cohort is getting closer and closer to the end, I can begin to see just how much I’ve learned and how far I’ve gotten since the beginning.</p><p>With our third project looming around the corner, I was determined to approach it differently, with a proper start and end. This meant I needed to create a user flow chart, a user story, and wireframes to prep and plan my project, all before I even started coding my web app. Although it was really more of a personal want to prepare these diagrams (since our instructors don’t require us to submit them), I desperately wanted to see my capability as a developer at this stage.</p><p>Our third project requirements were to:</p><ul><li>Incorporate Rails (our last project only used Ruby)</li><li>Have at least one has_many, at least one belongs_to, and at least two has_many :through relationships, with a many-to-many relationship between the has_many :through relationships</li><li>Have the join table include a user-submittable attribute other than foreign keys</li><li>Incorporate validations in our models, as well as display the errors on our views</li><li>Use an ActiveRecord scope method that uses ActiveRecord Query methods</li><li>Incorporate user authentication (sign-up, login, etc.) as well as Omniauth</li><li>Use nested resources, with specific inclusion of nested new and index or show routes</li><li>Make sure our code was DRY by using partials and helpers</li></ul><p>I started this off by creating said guides on draw.io.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*nBGujJC8uMc4v67yLzhQdw.jpeg" /><figcaption>I primarily drew my inspiration for my app from Goodreads</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*CvoBiaHmiYf2RDqU6VFB8w.jpeg" /><figcaption>I ended up going with 3 models with 2 join tables</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NdKSmznHfgqYf89ZpEwB8g.jpeg" /><figcaption>Just absolute chaos 🤯</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.figma.com%2Fembed%3Fembed_host%3Doembed%26url%3Dhttps%3A%2F%2Fwww.figma.com%2Ffile%2F28ekUpsmD83A1wnbSomFD9%2FRails-Project%3Fnode-id%3D0%253A1&amp;display_name=Figma&amp;url=https%3A%2F%2Fwww.figma.com%2Ffile%2F28ekUpsmD83A1wnbSomFD9%2FRails-Project%3Fnode-id%3D0%253A1&amp;image=https%3A%2F%2Fapi-cdn.figma.com%2Fresize%2Fthumbnails%2Fd13302a7-f856-4301-84cb-1d7444ff8366%3Fheight%3D246%26bucket%3Dfigma-alpha&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=figma" width="800" height="450" frameborder="0" scrolling="no"><a href="https://medium.com/media/3a266b8c2de3b7a65fe43f88bcee64de/href">https://medium.com/media/3a266b8c2de3b7a65fe43f88bcee64de/href</a></iframe><p>It’s very safe to say that I went above and beyond for this project. During the planning stage, I found myself packing in a lot of extra features that even I was unsure if I could manage to bring all of them to fruition. Overall, just conceptualizing, planning, and creating especially the wireframes took me three whole days. Throughout this process, I wondered aloud if all this was just a big time waster.</p><h4>Luckily, all this planning benefitted once I tackled the actual code.</h4><p>I referred to my models’ association table numerous times throughout the beginning and used the flow chart to then visualize the user experience and how I wanted the app to look and feel. Although a lot of my pages ended up not looking like my wireframes, it expedited my process as I was able to physically visualize where the buttons, links, headers, navigation bar, footer, etc. would go and how they’d look like. Once I got the bulk of my code finished, I was able to concentrate on Bootstrap and CSS to make my app look nicer and for most of the time, I referred to my wireframes.</p><p>Overall, this experience was undoubtedly a stressful one. There were so much about Rails and Bootstrap that I wasn’t exposed to and as even seasoned programmers would say, “Google was my best friend” (although all that knowledge floating around on Google was overwhelming to say the least). However, I learned so much in just these past two weeks, e.g. I learned how to use Figma and draw up wireframes for the first time. Yet, throughout the entire process, I found myself genuinely having fun creating my app as it consumed me. I was devising solutions and thinking of ways to approach a particular problem differently as I was brushing my teeth, eating breakfast — whenever and throughout any other mundane daily activities.</p><p>Although my current program at Flatiron is for software engineering, this project ultimately solidified my excitement and desire to work as a front-end developer once I graduated. I was quietly interested in design throughout college, so when deciding on bootcamps I initially wanted to go for UX/UI, but with my brother’s persuasion, I enrolled for software engineering. However, I don’t regret my decision one bit as I came to enjoy programming. Learning Ruby on Rails has been a great experience and I can’t wait to start learning Javascript.</p><p>Truthfully, I hadn’t felt this feeling of excitement and yearn to learn in a while and it’s been invigorating. It’s as if I returned back to myself as a child and the world is my oyster. It gives me peace and happiness to know that after all this time, I finally found what I want to do for a career.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15179f81c7dd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Daily Journal — A Sinatra Project]]></title>
            <link>https://kim-jenny5.medium.com/my-daily-journal-a-sinatra-project-86ed4994429b?source=rss-3c90ba9aa890------2</link>
            <guid isPermaLink="false">https://medium.com/p/86ed4994429b</guid>
            <category><![CDATA[journal]]></category>
            <category><![CDATA[flatiron]]></category>
            <category><![CDATA[sinatra]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Jenny Kim]]></dc:creator>
            <pubDate>Sat, 12 Jun 2021 23:53:47 GMT</pubDate>
            <atom:updated>2021-06-12T23:53:47.673Z</atom:updated>
            <content:encoded><![CDATA[<h3>My Daily Journal — A Sinatra Project</h3><p>For my second project at Flatiron, I decided to make a journal app, utilizing the knowledge we had accumulated in our lessons over the past couple of weeks.</p><p>The core requirements of this project were the following:</p><ul><li>Build an MVC Sinatra app and use ActiveRecord</li><li>Use multiple models, of which the User model has to have a has_many relationship and another model belongs_to the User model</li><li>Users must be able to sign-up/login and validate the uniqueness of their username</li><li>Users can <strong>C</strong>reate, <strong>R</strong>ead, <strong>U</strong>pdate, or <strong>D</strong>estroy only their entries</li></ul><p>In the beginning, I was completely lost as to where to start. My initial project idea was to make a productivity tracker app (I had even named it “Tracktivity”). But after mapping out its flow chart, I realized it wouldn’t have been possible with the amount of knowledge and time I had. Therefore, I turned to my secondary idea and a personal woe for me: journaling.</p><p>I always try to remind myself as much as possible to journal and write my thoughts at the end of the day as a way to wind down and introspect, but let’s be real. Who really has the time and motivation when you’re tired, to whip out your pen and notebook, when all you want to do is turn on Netflix and watch Tiger King? Using my laziness as a catalyst, I decided I should at least try to make it <strong>easy</strong> for me to journal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*xx3Uluc4wwteXgZ2SLe0Cw.png" /><figcaption>App’s flow chart</figcaption></figure><p>Truthfully, the hardest part of the project was planning out all the logistics of the app, since I didn’t want a situation where I was knee-deep into coding and realize that what I had envisioned wouldn’t work. After having decided on which/how many models I was going to do, which attributes for each model, and the general layout of my app, I was able to finally get started on my project!</p><p>Rather than having trouble with one big part of my project, I had trouble with little bits and pieces of my code here and there. Whenever I’d make a change here, something else would happen there. Other times, I’d forget that I made a change on a certain section and didn’t implement that change on my other views. This obviously pointed to a disorganized, chaotic process and not only was my project all over the place, but I was as well. This was a stark difference from my previous experience with my first project, where albeit my initial worries, my code and mental state felt very much organized.</p><p>As uncomfortable as this muddled state of mind was, it truly was a learning experience. Despite all this, I must admit I was quite proud of my work at the end of the day, as I showed off my accomplishment to my family and friends.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4asox7Hd6xC3GJ4afxCvTg.png" /><figcaption>Sign Up Page</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zvaaHWZRMRK_5PQx-Oy-8A.png" /><figcaption>User’s Home Page</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*An514aVRKRfkJiEqHPg89Q.png" /><figcaption>User’s Entries Page</figcaption></figure><p>As you can see, as I finished up completing the backend portion of my code, I focused a lot (okay, maybe a little too much…) of my remaining time on the frontend and visuals.</p><h3>Rack-Flash</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/236/0*NYAamznhINfXZvEu.jpg" /></figure><p>One seemingly easy task that I for some reason kept struggling with throughout my project was how to get Rack::Flash working. There were times when the flash message would appear as I expected, and other times when it didn’t. But what is programming without debugging? 🤷🏻‍♀️</p><p>I wanted my flash messages to look like error messages. So with the power of CSS, I made it look like the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V7s2Xz8xp2jL9pxSeGpPoA.png" /></figure><p>Can you see that tiny little yellow highlighted text on the top?</p><blockquote>“You don’t have access to that user’s entries.”</blockquote><p>Yup, that’s the flash message! This message would only appear if a user were to try to access another user’s entries. The code behind the message essentially blocks them from being able to hack that user’s account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*XA2a702hI3dBXliZIXWKhg.png" /><figcaption>Line 53 — the code behind the flash message in my User Controller</figcaption></figure><p>While I was able to find out the reasons behind why flash wasn’t working as expected, the process of debugging was a headache itself. The reason I continuously had issues with my flash messages was due to the if/else statements they were sandwiched between. Since the RESTFUL and redirect routes were intertwined with each other, if the user was NOT logged_in, my app would signal flash[:signed_out] (on line 57) and redirect the user to the login page. <em>However</em>, if the login page had a separate flash message (such as “Please log in” for users who were not logged_in?, then the message of “Please log in” would appear, rather than “You’ve been logged out. Please log back in.”</p><h3>My Overall Thoughts</h3><p>Having been jostled mentally and emotionally left and right from this project, I’m very much looking forward to our week of break before we begin our next phase. As I’ve stated previously, this project truly was a learning experience for me, both in terms of programming and wrestling with my inner chaos. Going forward, I’ve learned that consistent organization throughout the entire project is a must. I previously believed that as long as I carefully planned out my project in the beginning, continued organization would follow. Oh, how wrong I was. In my haste to fix their respective bugs, I found myself jumping from one controller to an index view and then to a show view and then to the other controller. As this was only my second project, I have yet to understand if this is very normal or if my programming process is simply disorganized. I guess only time will tell. 🤡</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=86ed4994429b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building My First Ruby CLI Gem and Un-Paginating an API]]></title>
            <link>https://kim-jenny5.medium.com/building-my-first-ruby-cli-gem-and-un-paginating-an-api-9ed46902a909?source=rss-3c90ba9aa890------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ed46902a909</guid>
            <category><![CDATA[rick-and-morty]]></category>
            <category><![CDATA[flatiron]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[cli]]></category>
            <category><![CDATA[ruby]]></category>
            <dc:creator><![CDATA[Jenny Kim]]></dc:creator>
            <pubDate>Wed, 14 Apr 2021 03:09:16 GMT</pubDate>
            <atom:updated>2021-04-14T03:09:16.822Z</atom:updated>
            <content:encoded><![CDATA[<p>Roughly a month and a half into my Software Engineering program at Flatiron, my classmates and I encountered our very first project of the course: building a Ruby gem that provides a CLI (<strong>C</strong>ommand <strong>L</strong>ine <strong>I</strong>nterface) to an external data source. Essentially, we were to choose an API (<strong>A</strong>pplication <strong>P</strong>rogramming <strong>I</strong>nterface) of our own choice, extract data from it, and create a gem that would allow the user to interact with said data.</p><p>As Project Week was nearing closer and closer, my panic increased accordingly. “Which API do I choose?” “Oh my god, what if my code sucks?” “Can I do it? Oh my god. I <em>can’t</em> do it.” With my imposter syndrome still deeply rooted in me, I was feeling a wide variety of emotions, from excitement to sheer dread.</p><p>The main point of the project was to code a program that allows the user to go one level deep, with “level” referring to the user being able to make a choice and then get back information based on that choice. However, I wanted to make my project even more interactive and fun. Therefore, with the idea of RPG/“choose your adventure” interactive games in mind, I decided to base my project off of a <a href="https://rickandmortyapi.com/">Rick and Morty API</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0JYuwk0cxUXQxUvm.jpg" /><figcaption>Rick (left) and Morty (right) are the titular characters of the show “Rick and Morty”</figcaption></figure><p>Being a fan of adult cartoons, especially Rick and Morty, I wanted to incorporate my interests into the project and really show my personality through it. I knew that if I went with the Rick and Morty API, I’d have access to hundreds of characters, and therefore be able to create that interactive gem I had in mind.</p><p>Soon after I decided on the API, I encountered an obstacle: it was paginated. My cohort did not discuss paginated APIs, nor did I know it was a thing. After reading multiple articles on it, I started to internally panic once again as I was now unsure of how to go about my project. Do I only base it off of the first page, which only included 20 characters? Do I abandon this API, along with the flow chart I created (albeit messily drawn in my notebook) and all the lofty ideas I had planned for it? Or should I find a way around it, despite the extra challenge?</p><p>I had already sunken hours into looking through different APIs and the idea of facing defeat without even trying didn’t sit right with me. Therefore, rather than run away from the challenge, I decided to face it head on.</p><p>While there were articles and Stack Overflow threads that provided solutions for paginated APIs, I didn’t recognize the methods they used, so I decided not to use them. I firmly wanted to only use code I was familiar with, especially since I’d have to explain it in detail later during my project review meeting.</p><p>The Rick and Morty API had 34 pages and 671 characters in total (as of April 2021), with 20 characters, or objects, on each page. I had the ambitious goal of wanting to access all 671 characters.</p><p>After multiple hours of playing around with my code and sending it through Pry, I finally decided to have the API run through REST Client twice. Mhm, you heard me right.</p><p>I wanted to keep my code as flexible as possible. Rather than hard code my program into telling it that the API had only 34 pages by setting a variable to the number 34, I wanted my program to grab the number of pages from the API itself each time it ran. Therefore, the first time was to grab the <em>number</em> of the API’s total pages, which I then shoveled in all 34 of their URLs into an empty array, so that the second time I ran it through REST Client was to iterate through that array to again shovel in each page’s data to another empty array. Afterwards, I used .flatten to flatten the end resulting array, since it essentially now was an array inside another array.</p><p>I understand the above word vomit may be a bit difficult to understand through English, so let’s try to use Ruby to explain my logic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*jCD8YLYurDW-1an-5ip1-Q.png" /><figcaption>First time I ran the API through REST Client</figcaption></figure><p>As you can see above, I ran the API’s URL through REST Client on line 5 and then parsed it with JSON on line 6 for readability. Afterwards, I took the API’s total number of pages, which was accessible within the &quot;pages&quot; key inside the &quot;info&quot; hash and set it equal to a variable called total_pages. This did the job of keeping my code flexible and always up-to-date, in the case that the API grew larger, thus having more pages.</p><p>The next obstacle was to have the program iterate through each page, so it could check for a Rick and Morty character if/when called. So, I had a variable called page_number set to 0 and used an until loop. As page_number incremented by 1 each time, all the URLs of the API’s pages would be added into an empty array called all_pages <em>until</em> it reached total_pages, or 34, the total number of pages in the Rick and Morty API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*94Qov9KXnyvQlnjx8thobA.png" /><figcaption>Second time</figcaption></figure><p>Now, this brings us to the second time I ran REST Client. I wanted one big array for my CLI class to access. Therefore, I iterated through the all_pages array, running each page through REST Client, parsed it with JSON, specifically only grabbing the &quot;results&quot; hash, which contained all the information I needed from the API, and finally shoveled all those pages into another array called all_data . Like I said before, this ultimately resulted in an array inside an array, so I flattened all_data into one array with .flatten and set it equal to a variable called characters, so I could easily access it.</p><p>With all this done and behind me, the next immediate step was to simply iterate through characters and initialize the objects, so I could begin writing my Character class.</p><p>Whew!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/299/0*sdNcRFMItYhnr6_h" /></figure><p>This was undoubtedly the most difficult process of my project since I had to figure out a way around this challenge all on my own. The rest of my project was <em>comparably </em>easier, especially since I had pseudocoded it out during the planning stage. While I may have overcomplicated it by running REST Client twice and creating two arrays, only to flatten it in the end, I believe that this was one of the better methods, especially with my current knowledge on programming.</p><p>Ultimately, I had so much fun doing and learning from this project. Despite the hours and emotions I poured into creating this gem for four days, one thing I most definitely gained from it was the enduring confidence that I can indeed overcome any programming obstacles that come my way. What an immeasurable feeling! Conclusively, as Rick best puts it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*Ic0k_Kz3yMU5QaLg.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ed46902a909" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why I Decided to Change Careers By Studying Software Engineering During a Pandemic]]></title>
            <link>https://kim-jenny5.medium.com/why-i-decided-to-change-careers-by-studying-software-engineering-during-a-pandemic-b7927a8196a1?source=rss-3c90ba9aa890------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7927a8196a1</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[career-change]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[covid19]]></category>
            <category><![CDATA[flatiron-school]]></category>
            <dc:creator><![CDATA[Jenny Kim]]></dc:creator>
            <pubDate>Thu, 25 Feb 2021 20:20:02 GMT</pubDate>
            <atom:updated>2021-04-01T17:31:06.123Z</atom:updated>
            <content:encoded><![CDATA[<h3>Why I Decided to Study Software Engineering and Change Careers During a Pandemic</h3><p>I had just received my job offer from a company I interviewed with in Tokyo, Japan and my first semester of senior year at Carnegie Mellon University was nearing its end. With everything from GPA to mental health positively lined up, I was certain nothing could get in the way for my last semester. I was prepared to go out to Wine Wednesdays with my girlfriends and thoroughly enjoy myself at Spring Carnival (a 3-day event we all used as an excuse to get flat out drunk in broad daylight) without the constant and excessive worry over jobs and grades.</p><p>Of course, this all came to a halt when COVID-19 broke out, spreading rapidly throughout the world, inevitably bringing it and every single plan I had made to a roaring stop.</p><p>“Haha… it won’t be that bad, right? I’ll be able to celebrate my birthday with my friends at the club by May, right?” I obsessively thought to myself. Although I retrospectively find my naive thoughts wildly laughable, they were not uncommon.</p><p>Ultimately, my job offer as an Associate Recruiting Consultant was rescinded, as moving across the world to Japan was unsurprisingly no longer an option. I successfully graduated from college with a degree in Business Administration and Japanese Language, but with all job prospects in my field of HR and recruiting as dry as the Sahara Desert, I moved back in with my mom and eventually found a temporary job to sustain myself.</p><p>Now that I was granted all the time in the world, I began to ponder whether my current career trajectory was what I really envisioned for myself. Did I really want to move to Japan, away from my family and friends in the States? Did I really want to work in a country whose language and culture I wasn’t innately fluent in? Did I want to spend my life and career as a recruiter? Or was I looking for something more exciting and groundbreaking, at the frontier of change?</p><p>“Look into coding, Jenny,” said my older brother. “This is the perfect time to learn a new skill and shift your career when the world is in chaos.”</p><p>Utterly lost and back to square one, I had nothing to lose. As a fresh college graduate and already in debt, I wasn’t interested in graduate school, which would cost two more years of my time. So, I turned my attention towards coding bootcamps.</p><p>I was always surrounded by programmers and designers back in college. Carnegie Mellon had no shortage of students interested and passionate about tech. Yet, imposter syndrome seemed to shadow me throughout all four years. Looking at some of my brilliant classmates, I thought, “How can I — me — possibly make it in tech when there are so many people smarter and more skilled than I?”</p><p>Having had enough of my fear of failure control me, I spent a majority of my summer and fall of 2020 researching and prying into the world of programming. The more and more I read through blogs and forums and watching YouTube videos, I increasingly saw excitement and appeal in a career in coding and designing. I wanted to join the wave as soon as possible and so, I bit the bullet and signed up for Flatiron School’s Software Engineering program.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CI5hQIXV65igSAOqOKg83Q.jpeg" /><figcaption>Me, as a child, typing one character at a time</figcaption></figure><p>Looking back, even as a child, I always had an interest in technology. As a longtime Apple fan, I jumped to watch Apple’s annual WWDC, interested in what new hardware and software the company had created this time. In terms of devices, I wanted the best of the best and always adopted electronics that would overall make my life and routines easier.</p><p>Although I don’t know what my future will look like, the pandemic certainly taught me how to be resilient and flexible with unexpected events — a newfound skill I’m sure will help with coding when I’m debugging with no end in sight.</p><p>I’m positive that with such dark days, there are bound to be days just as bright. Those are the moments I look forward to and that drive me to keep coding during times of frustration. Ultimately, I can’t wait to see where my programming journey will take me. I know there will be days where I sit in front of the computer with a blank face, not knowing how to execute the code or solve a bug. Or maybe I’ll find myself on a hot streak, completing labs after labs. Either way, I’m excited to discover another facet of myself and realize just how much I’ve learned at the end of these ten months. Similarly, on the same degree of excitement, I hope I’ll be able to move out of my mom’s house soon.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7927a8196a1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>