<?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 Ashley Mattam on Medium]]></title>
        <description><![CDATA[Stories by Ashley Mattam on Medium]]></description>
        <link>https://medium.com/@amattam427?source=rss-cb5c8db4b3b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*nWeCZY1FkDd7FjOZ</url>
            <title>Stories by Ashley Mattam on Medium</title>
            <link>https://medium.com/@amattam427?source=rss-cb5c8db4b3b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 13:27:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@amattam427/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[Intro to Rails Serializers]]></title>
            <link>https://medium.com/@amattam427/intro-to-rails-serializers-4925479db7f7?source=rss-cb5c8db4b3b------2</link>
            <guid isPermaLink="false">https://medium.com/p/4925479db7f7</guid>
            <category><![CDATA[serializers]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[active-model-serializer]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Ashley Mattam]]></dc:creator>
            <pubDate>Fri, 11 Mar 2022 11:31:49 GMT</pubDate>
            <atom:updated>2022-03-11T11:31:49.102Z</atom:updated>
            <content:encoded><![CDATA[<p>Ruby on Rails is amazing for building your own APIs. To help us structure the data send back to the client exactly the way we want, we can use Active Model Serializers.</p><p>Setup and Commands::</p><p>Before we run the command that creates our serializer we need to make sure we have the proper gem installed. In the Gemfile, add, <em>gem “active_model_serializers” </em>and run<em> bundle install</em> in the terminal. Once we add this to the Gemfile we can start creating our serializers.</p><p>To create a serializer, run <em>“rails g serializer name_of_serializer.” </em>You can start off by creating serializers for all your models. Once they’re created, they’ll look a little something like this (example from my recent project) ::</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*B5Fx8NqvM8-w8PgrB9R3yw.png" /></figure><p>If I were to run a request for tags I would see the id and name attribute listed in json format.</p><p>The app I created is a networking page for medical providers to post about different cases and have discussions with other medical providers. My main models are provider (holds providers basic info), case_comment, and cases. The relationship between the three models is as follows: the provider has many cases and case_comments, the case belongs to a provider and has many case_comments, and case_comment belongs to both a provider and a case.</p><p>Let’s say I wanted to look at all of the providers along with a list of the cases they’ve posted. I could simply include “has_many : cases” underneath the listed attributes::</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5lRoOQicoJ1gCgCb12QiPA.png" /></figure><p>Now when I look at my providers API I can see all of my desired information and render them to my frontend accordingly.</p><p>Custom Serializers and Custom Methods/Attributes::</p><p>Let’s say I wanted to look at all of my case_comments along with the provider that posted the case, and the case comments. Provider has so many attributes and we only want to render the provider&#39;s name and title. This is where we can create a custom serializer and insert it inside the CaseCommentSerializer. First, I created a custom serializer called ProviderDataForCasesSerialzer which included specific attributes from the provider&#39;s table:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*8Zi6VRoYieNeqn8tycWhjQ.png" /></figure><p>Then, I added this custom serializer to my CaseCommentSerializer:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*xYR2FwPy5GG3vRPUlOQZHA.png" /></figure><p>Now if I were to fetch the case_comments API, I would see the following information:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_1Y_l_lj8RLo3S6OXUZuXQ.png" /></figure><p>Finally, onto creating a custom method with serializers. For my project, I wanted to create an API for a specific case that rendered all of the case info, name/title of the provider who posted it, and their comments in which I also wanted to include the name of the provider who wrote the comment. In order for this to work, I created a couple of custom serializers:</p><ol><li>To include specific attributes from the provider table:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*NWlk6W8g56MquzWC_RrddQ.png" /></figure><p>2. To include the name of the provider along with their comment (this is where I created a custom attribute called “:provider_name”):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*Iva3pw3V-zUVThAj4N3VPg.png" /></figure><p>3. The final custom serializer is to render the other two serializers:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*pB4raL1EemcczsHokhbRbg.png" /></figure><p>Serializers are a must when creating your own API. It helps keep your data organized exactly the way you want. Finally, remember to add your serializer to your route(s) inside the controller file.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4925479db7f7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I created a CRUD API in Sinatra (Backend) and used it in React.js (Frontend)]]></title>
            <link>https://medium.com/@amattam427/how-i-created-a-crud-api-in-sinatra-backend-and-used-it-in-react-js-frontend-b65c7b9acf70?source=rss-cb5c8db4b3b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b65c7b9acf70</guid>
            <category><![CDATA[sinatra]]></category>
            <category><![CDATA[crud-methods]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[ruby]]></category>
            <dc:creator><![CDATA[Ashley Mattam]]></dc:creator>
            <pubDate>Fri, 18 Feb 2022 20:42:55 GMT</pubDate>
            <atom:updated>2022-02-18T20:42:55.553Z</atom:updated>
            <content:encoded><![CDATA[<p>I recently created an application called Luxe Vacations. This application is essentially a vacation finder app geared towards couples. In this post, I am going to go over what CRUD actions I used, how I created them in the backend, and how I used them on my frontend.</p><p>Let’s start with what I did in the backend with Sinatra:</p><p>First I created two models with a one-to-many relationship — review, and accommodation, and made sure they both were set to inherit Active Record methods. I set it so that accommodation has many reviews and reviews belongs to accommodation. After setting up the models I created my tables by running <em>bundle exec rake db:create_migration NAME=create_accommodations</em> and<em> db:create_migration NAME=create_reviews</em>. Once I created my table and columns inside the files I ran <em>bundle exec rake db:migrate</em> to run the migrations. Next, I needed to create some initial data for my database which I simply just added to my seeds file. After creating my data I ran <em>bundle exec rake db:seed</em> to run the code in the file.</p><p>Finally, I set up my controller files to create my CRUD actions. We already had an ApplicationController file set up inside our controller’s folder. This file is set to inherit the Sinatra methods. From here, we need to create separate controller files inside the same folder for each other your models and each of these controller files should inherit the original ApplicationController file to get all the same methods. Essentially these controllers are responsible for receiving a request and using the model to generate data needed for the view. For my project, I needed to create a ReviewController and an AccommodationController. However, I needed to rename my AccommodationController file because Sinatra (oddly) runs the controller files in alphabetical order. In order for it to work the way, I wanted it to I simply added a “b” in front of the accommodation controller file. Essentially I renamed just the file itself from accommodation_controller.rb to baccommodation_controller.rb. In these controller files, I set up my API routes for my CRUD actions.</p><p>The ones I’m going to go over are listed inside my review_controller.rb:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*jkCpBJ8exJuhkhZM2ck8mA.png" /></figure><p>The get action is allowing us to grab all of the reviews for a specific accommodation. We are calling the id of a specific accommodation and then grabbing the review(s) for it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*rSSkE_WM6B1DVmqS3yNRbg.png" /></figure><p>This post action is allowing us to post a new review in the server to a specific accommodation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*fuIAQ7RljmmTkKvTiR_GUg.png" /></figure><p>Lastly, we have a delete action allowing us to delete a review from the server.</p><p>Using these actions in the frontend:</p><p>To use them in frontend, we simply fetch the API like we normally would inside React.js. We would fetch the local host and include the path we created inside Sinatra based on which CRUD action you want to use. For example, here is what my code for delete request looks like from the frontend:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*PzIRjq-uLUqP9EV2UWSotg.png" /></figure><p>Essentially everything else we do in the frontend is the same. The only difference is that we have a specific path for every CRUD action which makes things a bit more organized.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b65c7b9acf70" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HTTP PATCH Method using React.js]]></title>
            <link>https://medium.com/@amattam427/http-patch-method-237f60662652?source=rss-cb5c8db4b3b------2</link>
            <guid isPermaLink="false">https://medium.com/p/237f60662652</guid>
            <category><![CDATA[http-request]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[patch-method]]></category>
            <dc:creator><![CDATA[Ashley Mattam]]></dc:creator>
            <pubDate>Mon, 31 Jan 2022 04:14:01 GMT</pubDate>
            <atom:updated>2022-02-01T23:59:54.186Z</atom:updated>
            <content:encoded><![CDATA[<p>Before we discuss what the PATCH method is let’s briefly what CRUD is. CRUD stands for Create, read, update and delete.</p><p>To<strong> create</strong> a new item to our database on the server whenever the user either submits a form or adds a new item to the page, we would most commonly use the POST method.</p><p>To <strong>read</strong> resources in a REST environment, or in other words display a list of items from the server when the application first renders, we would use the GET method.</p><p>To <strong>update </strong>a specific piece of data from the database or the entire database, we would use the PATCH or PUT method. A PUT method would be used if the entire database needs to be updated while the PATCH method would be used if we’re doing a partial update.</p><p>Lastly, to <strong>delete</strong> or remove data from the server we should use the DELETE method.</p><p>The PATCH method is very similar to the PUT method because it also modifies an existing resource. The difference is that for the PUT method, the request body contains the complete new version of the data, whereas, for the PATCH method, the request body only needs to contain the specific changes.</p><p>Here’s an example of the PATCH method I used on a project I built for my Bootcamp (that’s still in progress). I created an app called FabBeauty that essentially helps users find the right product themselves based on reviews, likes, etc. When the application first renders you see a display of makeup items along with the name of the product and brand, as well as the price and number of likes each product has. I used the PATCH request so that the user is able to increase the number of likes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z60g05hqni59gOJAFzSx0Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mZXifNhxomzwW0_UYWbXjA.png" /></figure><p>Here is the code I wrote to make this happen::</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*QovAIug4M3bnJRU3QU0gTw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*E8pPoMxnmn-2SJqEgrgS9g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7wlWEdgDImAwU23xQj42vg.png" /></figure><p>After creating an initial state and pulling the data from the JSON file using the GET method, I used the map method to return a new array of the same length as the original array. In that same function where we are mapping, we want to make sure that we are only updating the likes for a “specific” product. We don’t want to update the likes of all of the products in our database. We want to make sure that it only updates if it matches the proper “id” of the product we’re updating.</p><p>I then pass the functions and the original data to the component where I want to create the PATCH method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*og3uWACmlRCkOxcCk5fhrQ.png" /></figure><p>After we define all the data that I want to be displayed, I created a handleLikes function that will hold my PATCH request. Before fetching the data for my request, I created a variable that explains to the server that I want to increase my “likes” object by 1. Then, I fetched my data, and just like with a POST request, we need to specify the method, headers, and body options for our PATCH request as well. We also need to include the item’s ID in the URL so that our server knows which item we’re trying to update. Lastly, I passed the function down to the likes button and created an OnClick event listener so that every time the user clicks the button the function renders.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=237f60662652" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Journey to Starting Coding BootCamp]]></title>
            <link>https://medium.com/@amattam427/my-journey-to-starting-coding-bootcamp-fc9d396c1723?source=rss-cb5c8db4b3b------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc9d396c1723</guid>
            <category><![CDATA[codingbootcamp]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Ashley Mattam]]></dc:creator>
            <pubDate>Fri, 10 Dec 2021 04:46:23 GMT</pubDate>
            <atom:updated>2021-12-10T04:49:45.874Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r_1ndjdOEpvL2bKYzQ2oMQ.png" /></figure><p>July 2021, with the assistance of <a href="https://www.codecademy.com/">codecademy.com</a>, I wrote my first HTML file and created a page about The Brown Bear. Today, December 9th, 2021, I am finishing up week three of the Software Engineering Immersive Program at Flatiron School. How did I get here you ask? Let’s start at the very beginning…</p><p><strong>Rewind</strong></p><p>Growing up I was never really sure what I wanted to do with my life and I never really liked school to be quite honest. When it came time to apply for colleges my family had convinced me to go for something in the medical field. So I said okay and ended up majoring in biology and the plan was to apply to nursing school after. Around my junior year of college, I finally came to the realization that I definitely did not want to pursue a career in nursing and that I was just doing it because my family convinced me to.</p><p>After graduating college, I worked at a doctor&#39;s office for about three years. I started off as a secretary and eventually worked my way up to administrative supervisor. From there I thought maybe I want to stay in healthcare but work on the administration side. I knew I enjoyed being in healthcare and I felt comfortable because it was easy for me to communicate with doctors, nurses, and other healthcare professionals. However, as much as I loved working at the doctor&#39;s, I decided that it was best for me to leave and look for other opportunities that can provide me with more experience. That’s when I got an opportunity to work for a health-tech startup called Simplifeye.</p><p>At Simplifeye I started off as a Product Operations Specialist and eventually worked my way to a Senior Product Operations Specialist. It was at Simplifeye where I met my very first Software Engineer. To be quite honest, I’ve heard of Software Engineers before but I never really knew what they did until I started working at Simplifeye. I was immediately very intrigued by coding and the fact that they, my coworkers, were able to build AMAZING products. It had crossed my mind for a split second, at the time I thought to myself, “Do I want to learn how to code?” Then after taking a peek at one of their computers I was immediately terrified of all the code I saw. It looked like jibberish to me. I quickly shut the idea down and just continued to work as a Product Ops Specialist.</p><p>After two years I noticed myself not being motivated to work anymore and being very bored. I felt like my days were so repetitive and I was doing the same thing every single day. I was continuously asking for more responsibility to help myself grow professionally. Eventually, it came to a point where I felt like they had nothing left to teach me and I wasn’t really growing anymore. I felt like I was at a standstill. I enjoy being challenged and learning new things. So what did I do about it? I started applying for jobs.</p><p>I was applying for months and months, always made it to the final interview portion but then never got the offer. After about 4 months of applying, I had randomly come across a TikTok about the day in the life of a software engineer. That same day I saw an ad on my Instagram about a coding BootCamp. After seeing the ad, I convinced myself to just try it out. There are free resources online, why not see if I enjoy it, there’s nothing to lose! That’s when I went on codecademy.com and learned some HTML about the Brown Bear. A few days later, I contacted my friend, Sangeetha, who actually graduated from Flatiron School in 2018 and is now working as a Software Engineer.</p><p>She told me about her experience there and why she’s extremely happy about the decision she made to go there. She advised me to practice a bit more before I came to a decision. For the next month or two, I taught myself HTML, CSS, and a little bit of JavaScript. I was hooked!! I loved how challenging it was and I loved how I felt when I was able to get through the challenge. In the middle of September, I decided to apply to Flatiron School and was so excited when I got my acceptance letter a few weeks later!</p><p>The past three weeks have been nothing but crazy. I’m not going to lie, Bootcamp is no joke. I’ve probably had about three mental breakdowns so far but that’s not going to stop me from continuing this journey. I knew that coming into this was going to be hard. But you know what? Nothing in life comes easy and I don&#39;t regret the decision I made! My advice to anyone starting a coding Bootcamp is definitely to mentally prep yourself. Also, I would try to become a little familiar with some JavaScript basics, it’ll set you up for a better experience right from the start. And if you ever doubt yourself, DON’T! We got this!! I’m excited to see myself grow throughout this program and become better at code every day!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc9d396c1723" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>