<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Anya Brun</title>
    <description>The latest articles on DEV Community by Anya Brun (@tsbrun).</description>
    <link>https://dev.to/tsbrun</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F373231%2F360b98f6-18ec-4e79-8066-5806b6afd0f9.jpeg</url>
      <title>DEV Community: Anya Brun</title>
      <link>https://dev.to/tsbrun</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tsbrun"/>
    <language>en</language>
    <item>
      <title>My first week as a web developer</title>
      <dc:creator>Anya Brun</dc:creator>
      <pubDate>Fri, 08 Jul 2022 01:14:46 +0000</pubDate>
      <link>https://dev.to/tsbrun/my-first-week-as-a-web-developer-ke</link>
      <guid>https://dev.to/tsbrun/my-first-week-as-a-web-developer-ke</guid>
      <description>&lt;p&gt;Today officially concludes the first week of my new job. I know it’s only Thursday, but I started last week on Thursday, so technically it’s been a full week. At least, I think it has but I’m not good with elapsed time. I digress…&lt;/p&gt;

&lt;p&gt;I’m working for &lt;a href="https://btwb.com/"&gt;btwb&lt;/a&gt;, a company that connects CrossFit gyms across the US and provides workout programs, trackers, and analytics for both athletes and gym owners. For now, I’ll be working on their web app, using Rails and Bootstrap 5.&lt;/p&gt;

&lt;p&gt;I haven’t gotten to know any of my coworkers very well yet, but they seem cool. It feels weird to call them coworkers, honestly. They’ve all been doing this for probably more than 10 years (not trying to offend anyone but they’re all at least 30, I’m pretty sure). I feel more like a kid on a soccer team, except I’m the only person on the soccer team and I have like 4 different coaches. And I only just started playing soccer and I’m terrible at it because I’m an asthmatic nerd (true story). &lt;/p&gt;

&lt;p&gt;A flawed analogy, maybe, but that’s what I could think of in the moment. Honestly, my brain is fried from trying to get my machine set up for work. &lt;/p&gt;

&lt;p&gt;It’s been a saga…&lt;/p&gt;

&lt;p&gt;First, I downloaded the source code to my machine and tried to set up my dev environment with all the gems and tools I’d need. A couple gems in particular (first it was idn-ruby then solr) weren’t playing nicely with the M1 chip on my new laptop, so it took an entire day of reading error messages, looking up pull requests and Stack Overflow posts, trying commands that returned new errors, rinse and repeat. The senior engineer who’s basically mentoring me—Corey—did most of the legwork, of course. At one point, we had to go into the solr bin files and delete a bunch of VM options. &lt;/p&gt;

&lt;p&gt;I could write a blog post going in-depth into what the actual errors were and how we fixed them, but it’s too soon to revisit the trauma…&lt;/p&gt;

&lt;p&gt;On Tuesday, one of the backend devs—Ben—made a devcontainer for the dev environment, so I spent the rest of the week setting it up. In my efforts to get that working, I learned about &lt;code&gt;git stash&lt;/code&gt; , discovered &lt;strong&gt;Cmd+Shift+G&lt;/strong&gt; in Finder, and poked through the mysql folder on my machine in search of the &lt;code&gt;my.cnf&lt;/code&gt; file. Fun Fact: it’s not provided in the mac OS installation of mysql. &lt;/p&gt;

&lt;p&gt;Aside from technical stuff, I’ve also learned to ask stupid questions. When I was setting up my machine that first time, I deliberated for a good 10 minutes whether or not to send a message in the Slack channel. I thought that I was asking a super obvious question and my boss would figure out how dumb I was and fire me. You could say I’m a bit of a catastrophizer. &lt;/p&gt;

&lt;p&gt;Turns out my question wasn’t that dumb, seeing as it took me and Corey (and Ben, a little) an entire day (and then some) to figure it out. If I hadn’t asked, I would be completely stuck. Kudos to the dev team for being super welcoming and willing to answer my questions; that definitely mitigates the apprehension to ask for help.&lt;/p&gt;

&lt;p&gt;Other than trying to get my environment up and running, I’ve just been reading docs and attending meetings. I don’t have much to contribute at the moment since I’m still getting my bearings, so I mostly listen and take notes. I’m trying to absorb as much knowledge via osmosis as I can. &lt;/p&gt;

&lt;p&gt;As for learning outside of work, I bought Justin Weiss’ book—Practicing Rails. I’ve gone through two chapters, so far, and I’ve already gotten some valuable insights. &lt;/p&gt;

&lt;p&gt;For one, Justin suggests having a list of app types that you refer to whenever you need to quickly spin up an app to test a concept. That way, you have a list of apps that you’re familiar with (because you’ve used them to practice over and over again) so you know exactly what features you need and how to build them. He also emphasizes writing exactly the code you need for whatever feature you’re working on right now and nothing more. &lt;/p&gt;

&lt;p&gt;The book’s overall philosophy on learning is very hands-on, which works well with my brain. &lt;/p&gt;

&lt;p&gt;I’m also working through UCSD’s Data Structures and Algorithms specialization on Coursera—slowly, but surely. &lt;/p&gt;

&lt;p&gt;All in all, it’s been a good first week and I’m excited for what comes next.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>career</category>
      <category>writing</category>
      <category>beginners</category>
    </item>
    <item>
      <title>My first tech conference</title>
      <dc:creator>Anya Brun</dc:creator>
      <pubDate>Wed, 22 Jun 2022 19:03:00 +0000</pubDate>
      <link>https://dev.to/tsbrun/my-first-tech-conference-3fp6</link>
      <guid>https://dev.to/tsbrun/my-first-tech-conference-3fp6</guid>
      <description>&lt;p&gt;On June 16th, I attended CodeLand 2022 – my first tech conference. I was a bit nervous but it was a great experience! &lt;/p&gt;

&lt;p&gt;The convention was streamed live on the CodeNewbie Community platform. Nearly every speaker also had a post on CodeNewbie where you could watch their talk on-demand and post comments for them to respond to during the live questions panel. &lt;/p&gt;

&lt;p&gt;CodeLand markets itself as a convention for early-career developers, and I definitely felt comfortable and welcomed as an individual relatively new to the tech industry looking for my first job. The talks were geared perfectly to the audience and I learned a lot.&lt;/p&gt;

&lt;p&gt;What really impressed me about CodeLand 2022 was 1) the diversity of speakers and 2) the &lt;strong&gt;amazing&lt;/strong&gt; captions. &lt;/p&gt;

&lt;p&gt;Seriously, though—it’s shocking how bad captions can be for popular streaming services like Netflix or even live television. Not only are they poorly formatted so that it’s difficult to tell which person said what, but they often completely omit sentences or paraphrase instead of transcribing the dialogue.&lt;/p&gt;

&lt;p&gt;In contrast, CodeLand’s captions were clear, accurate, and any mistakes in the transcription were corrected promptly. &lt;/p&gt;

&lt;p&gt;I almost always have captions on because sometimes it’s difficult for me to interpret the sounds people make into words (weird, I know), especially when I’m not used to how they speak or I’m not with the person face-to-face. That’s part of the reason why I absolutely hate phone calls, lol. &lt;/p&gt;

&lt;p&gt;The importance of diversity, accessibility, and inclusion was a major theme throughout the conference and it’s clear that the organizers of CodeLand 2022 practice what they preach.&lt;/p&gt;

&lt;p&gt;My favorite talks were definitely Kelsey Hightower’s keynote speech and Silvia’s España’s talk on pseudocode. I’ve yet to watch the on-demand videos from Friday’s speakers, but I plan to do that at latest by this weekend. &lt;/p&gt;

&lt;p&gt;Here are some particularly wise tidbits gleaned from my notes: &lt;/p&gt;

&lt;p&gt;Kelsey Hightower — Fireside Chat&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;“Opportunities are not given; they’re taken”&lt;/li&gt;
&lt;li&gt;“Make me respect me tomorrow morning”&lt;/li&gt;
&lt;li&gt;Become a T-shaped developer: breadth of knowledge, depth in one area&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Tracy P. Holmes — Redefining Your Programming Purpose&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;“I decided to be myself and people responded to it.” &lt;/li&gt;
&lt;li&gt;“If what you want doesn’t exist, create it… Sometimes people don’t know what they need.”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Joe Glombek — Celebrate Your Misteaks&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Turn mistakes into a learning experience&lt;/li&gt;
&lt;li&gt;Share your mistakes with other people as often as possible&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Haimantike Mitra — Next-Gen Inclusivity: How Gen Z Can Make Real Change in Tech&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Be (or initiate) the change you want to see&lt;/li&gt;
&lt;li&gt;Reach out 1:1 on social media to network and look for mentors, even if you’re shy or hesitant &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Derek Binkley — Live Q&amp;amp;A Panel, in response to my question about getting feedback on your code as a solo developer&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Get into a community, develop relationships, and ask if people are willing to look over your code&lt;/li&gt;
&lt;li&gt;Open up a pull request and give yourself a code review. Just the act of explaining what you’re doing out loud is helpful&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Raymond Chung — A Programmer’s Guide to Mental Health&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When you get stuck, &lt;strong&gt;take a break&lt;/strong&gt;! (emphasis mine, lol)&lt;/li&gt;
&lt;li&gt;Make a list of positive affirmations and keep it visible &lt;/li&gt;
&lt;li&gt;Take the initiative to reach out to your mentor / tech lead&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Silvia España — I Think, Therefore I Code&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pseudocode allows you to think through the algorithm &lt;em&gt;before&lt;/em&gt; you code it&lt;/li&gt;
&lt;li&gt;Don’t “contaminate” your pseudocode with the language you’re going to use to code the solution &lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;I’m glad I was able to attend CodeLand 2022. Definitely check out the on-demand talks on CodeNewbie Community if you’re just starting out your career in tech, or if you want to learn more about facilitating diversity and inclusion within the industry.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>writing</category>
      <category>devjournal</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Advice I’d give my younger self</title>
      <dc:creator>Anya Brun</dc:creator>
      <pubDate>Wed, 15 Jun 2022 18:52:10 +0000</pubDate>
      <link>https://dev.to/tsbrun/advice-id-give-my-younger-self-5a50</link>
      <guid>https://dev.to/tsbrun/advice-id-give-my-younger-self-5a50</guid>
      <description>&lt;p&gt;These are things I wish someone had told me 2 years ago, when I started learning how to code in earnest…&lt;/p&gt;

&lt;h2&gt;
  
  
  Start learning data structures and algorithms as early as possible, not right after bootcamp when you have to get ready for interviews.
&lt;/h2&gt;

&lt;p&gt;Not only do many (if not most) interviewers ask DSA questions, but practicing data structures and algorithms will help you learn to think like a programmer and fast-track your ability to build and debug useful software. &lt;/p&gt;

&lt;p&gt;The resources I’m using are Leetcode, Crack the Coding Interview, the BaseCS podcast (I listen on Spotify), as well as the CS50 and MIT Courseware lectures. &lt;/p&gt;

&lt;p&gt;Some alternatives are HackerRank, AlgoExpert, The Imposter’s Handbook, and the numerous videos and lectures on DSAs available on Youtube.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build projects that solve real-world problems.
&lt;/h2&gt;

&lt;p&gt;It might be easy to think that what you build doesn’t necessarily matter, as long as it demonstrates your skills or shows that you learned something. However, an interviewer doesn’t just want to know that you can code. They want to know whether you can write code that fills their needs. &lt;/p&gt;

&lt;p&gt;This is where coming into tech from a different career—like teaching or marketing, for example—comes in handy. Your background gives you insight into real-world problems within your industry that an application (&lt;em&gt;your application&lt;/em&gt;) can solve. &lt;/p&gt;

&lt;p&gt;It also helps to build clones of popular types of applications. If you’re a web developer, for example, you can code a clone of an online store like Etsy.&lt;/p&gt;

&lt;p&gt;Another bonus is that having a robust project allows you to take the lead in an interview. If you show the interviewer your project and it’s something that catches their attention, then they’ll start asking you questions—questions you can answer confidently and competently because you (hopefully) know the ins and outs of your project after working on it so diligently. &lt;/p&gt;

&lt;h2&gt;
  
  
  Apply for internships during bootcamp, if your schedule allows.
&lt;/h2&gt;

&lt;p&gt;This point is especially relevant if you’ve been practicing data structures and algorithms early on. CS students in traditional universities don’t wait until they graduate to apply for internships. In fact, many apply within their freshman or sophomore years. &lt;/p&gt;

&lt;p&gt;Likewise, don’t wait until you’ve graduated your bootcamp to apply for an internship. An internship will help you gain relevant experience to put on your resume that can shorten your timeline for getting a job after you graduate. There are several companies that offer internships to candidates from non-traditional backgrounds, so don’t worry about needing a CS degree.&lt;/p&gt;

&lt;h2&gt;
  
  
  On that note, make sure your LinkedIn profile is up to par.
&lt;/h2&gt;

&lt;p&gt;It’s key that your profile has a picture and links to your Github, personal website, and your dev blog. Update your profiles and portfolio with projects that you build as you’re learning. &lt;/p&gt;

&lt;h2&gt;
  
  
  Start blogging as early as possible…
&lt;/h2&gt;

&lt;p&gt;…Even if it’s not about anything deeply technical. Just chronicle your journey of learning how to code. &lt;/p&gt;

&lt;p&gt;It will help you sharpen your written communication (a key soft-skill, especially in the age of remote work) and allow you to build a professional presence and community online. People may even reach out to you for opportunities if they like your work. &lt;/p&gt;

&lt;h2&gt;
  
  
  Take advantage of the community.
&lt;/h2&gt;

&lt;p&gt;Reach out to people on LinkedIn who have a similar professional background as you or who are in the roles you want to be in. Ask for informational interviews or offer to buy them a coffee and chat about what it’s like to be in the industry. &lt;/p&gt;

&lt;p&gt;Doing so will get you talking about code and making professional connections (i.e., &lt;em&gt;networking&lt;/em&gt;) that will serve you well in your future job search. &lt;/p&gt;

&lt;h2&gt;
  
  
  Consistency is key - slow down if you need to and &lt;strong&gt;ask for help&lt;/strong&gt;!
&lt;/h2&gt;

&lt;p&gt;Don’t stress out if you can’t dedicate 10 hrs a day to coding. Even if all you can do is work on a project for 1 hour, it counts. Each hour is another cobblestone on the path to becoming a software developer. You’ll get there eventually—&lt;em&gt;if&lt;/em&gt; you don’t burn yourself out. &lt;/p&gt;

&lt;p&gt;Also, &lt;em&gt;please&lt;/em&gt; don’t be afraid to ask for help when you need it. Leave comments on blog posts about concepts you’re struggling with and post questions to Stack Overflow. People in general are really nice and more than willing to help you out. &lt;/p&gt;

&lt;p&gt;No programmer is an island; whether or not you identify as self-taught, no one can learn how to code alone. &lt;/p&gt;




&lt;p&gt;Hopefully these insights can help you avoid some of the mistakes I made in the 2 years since I’ve been learning to code. If you have any experiences or recommendations, feel free to share them in the comments. &lt;/p&gt;

&lt;p&gt;The more we share, the easier it gets for the next batch of self-taught and bootcamp developers to navigate the often difficult and confusing process of becoming a software engineer. &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>writing</category>
      <category>devjournal</category>
      <category>career</category>
    </item>
    <item>
      <title>Quick life update</title>
      <dc:creator>Anya Brun</dc:creator>
      <pubDate>Mon, 13 Jun 2022 20:25:30 +0000</pubDate>
      <link>https://dev.to/tsbrun/quick-life-update-1lho</link>
      <guid>https://dev.to/tsbrun/quick-life-update-1lho</guid>
      <description>&lt;p&gt;I’ve been trying to structure my DSA study, and &lt;a href="https://www.youtube.com/watch?v=dR6n0uLk1KQ"&gt;this video by Maya Bello&lt;/a&gt; where she ranks the resources she used to study for technical interviews was immensely helpful.&lt;/p&gt;

&lt;p&gt;I’m going to use the Technical Interview Study Guide by Eric Duran to track my progress, and I’ll tackle one DSA each week. The schedule I’ve worked out is as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Monday - watch lectures / videos (MIT Open Courseware, HackerRank, etc) + read relevant chapter of Crack the Coding Interview &lt;/li&gt;
&lt;li&gt;Tuesday - do 2-3 problems on Leetcode &lt;/li&gt;
&lt;li&gt;Wednesday - use practice questions from Crack the Coding Interview chapter to practice whiteboarding &lt;/li&gt;
&lt;li&gt;Thursday - practice answering JS and React-specific interview questions &lt;/li&gt;
&lt;li&gt;Friday - do more Leetcode problems &lt;/li&gt;
&lt;li&gt;Saturday - practice writing DSAs from scratch &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I still have to work on my portfolio projects, so I’ll focus on DSAs in the morning and do project work in the afternoon. &lt;/p&gt;

&lt;p&gt;My first mini-project is to create my personal website with React and host it on a cloud service, like AWS Amplify. I had actually planned on completing that this past weekend, but there was an unforeseen setback. My MacBook sustained liquid damage and is being repaired right now, so I probably won’t have access to it until Wednesday… 😭&lt;/p&gt;

&lt;p&gt;Even without my laptop, I can still watch videos on Youtube, read CCI, and do practice questions. The first topic on Duran’s study guide is Big O and that’s scary and intimidating, so I’ll start with the topic right after — strings, lmho. &lt;/p&gt;

&lt;p&gt;As far as my job search goes, I’ve been applying to software engineering internship programs (specifically ones that don’t require CS degrees), so hopefully I’ll hear something soon. &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>devjournal</category>
      <category>writing</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>rails new task-team</title>
      <dc:creator>Anya Brun</dc:creator>
      <pubDate>Mon, 06 Jun 2022 22:32:38 +0000</pubDate>
      <link>https://dev.to/tsbrun/rails-new-task-team-353m</link>
      <guid>https://dev.to/tsbrun/rails-new-task-team-353m</guid>
      <description>&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: I wrote this blog post some time ago for Phase 3 of my Flatiron School SE program.&lt;/p&gt;

&lt;p&gt;My goal for this project was to refine my process for building apps, in order to do so more efficiently. I came up with the following list of steps + questions to guide the development process:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Brainstorm app idea&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What problem do you want to solve?&lt;/li&gt;
&lt;li&gt;What experience do you want to provide?&lt;/li&gt;
&lt;li&gt;Is there something your app can make more convenient or less confusing/time-intensive?&lt;/li&gt;
&lt;li&gt;Why should a user choose your app over another?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Write up User Stories&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Who is going to use your app? What is your target audience?&lt;/li&gt;
&lt;li&gt;What exactly will members of that audience want to do with your app? &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Draft a list of features&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What features &lt;em&gt;make&lt;/em&gt; the app? What are the MVP (minimum viable product) features?&lt;/li&gt;
&lt;li&gt;What stretch features will you add if the MVP is completed ahead of schedule? &lt;/li&gt;
&lt;li&gt;What features can you omit from the first version? What features will be added with subsequent releases of your app?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Backend, pt. 1 - Schema, Models, and Associations&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What models does your app need? What attributes do those models have?&lt;/li&gt;
&lt;li&gt;How are those models related? What associations are necessary to make these relationships work? &lt;/li&gt;
&lt;li&gt;Create a detailed schema diagram.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Backend, pt. 2 - &lt;code&gt;bin/rails console&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Write out seed data based on your user stories.&lt;/li&gt;
&lt;li&gt;Test associations in the Rails console. Be thorough and use the seed data to exercise your models &amp;amp; associations in a similar manner to how they'll be used in-app. &lt;/li&gt;
&lt;li&gt;Make any changes to models or schema, if necessary.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: go &lt;strong&gt;feature by feature&lt;/strong&gt; (i.e., build vertically).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Frontend, pt. 1 - views&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Make mock-ups (e.g., wireframes) of every page (or the most important ones, at least) your app will need. &lt;/li&gt;
&lt;li&gt;Note how a user will get from one page to another, and consider a nav menu for getting to frequently-used pages quickly.&lt;/li&gt;
&lt;li&gt;Generate dummy views (e.g., a login form that isn't connected to the backend). &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Frontend, pt. 2 - controllers&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Generate controllers and routes needed for the feature you're working on. &lt;/li&gt;
&lt;li&gt;Make the "dummy" views "smart" by grabbing and/or manipulating the data you need and displaying them to the user.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;DRY things up&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Consider ways you can slim down your controllers by extrapolating logic into class/instance methods on models.&lt;/li&gt;
&lt;li&gt;Write helper methods for actions you perform repeatedly, such as grabbing the current user from the &lt;code&gt;session&lt;/code&gt; user id.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Finishing touches&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Style your app, maybe using a framework or some simple HTML &amp;amp; CSS.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: I have yet to start writing tests. However, I plan on incorporating this into my development process in the future. As of now, I'm relying on manually testing stuff like models, views, &amp;amp;c. &lt;/p&gt;

&lt;p&gt;The aspect of the development process with which I had the most difficulty was creating the backend--namely, creating and associating models in a way that made sense for my app.&lt;/p&gt;

&lt;p&gt;The (relatively) final version of my app ended up with 4 models: &lt;code&gt;User&lt;/code&gt;, &lt;code&gt;Team&lt;/code&gt;, &lt;code&gt;List&lt;/code&gt;, and &lt;code&gt;Task&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;Initially, though, I didn't have the &lt;code&gt;Task&lt;/code&gt; model. I was trying to associate the remaining as follows: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;User has_many lists and has_many teams through lists &lt;/li&gt;
&lt;li&gt;Team has_many lists and has_many users through lists&lt;/li&gt;
&lt;li&gt;List belongs_to user and belongs_to team&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That wasn't working because it didn't make sense for List to be the join-table, as it were, between User and Team. And building the association the other didn't make sense because a List can't &lt;strong&gt;have_many teams&lt;/strong&gt;. No matter how I tried to make it work, it wouldn't--because that's not the relationship between these models "in real life." &lt;/p&gt;

&lt;p&gt;Outside the context of a Rails database, a User can work independently of a Team, as well as collaborate with other people. A person belongs to a Team, and the people on that team may be grouped into sub-teams (which I simplified into Lists) to work on different tasks. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A User (optionally) belongs to a team, has many tasks, and has many lists through tasks. The tasks are directly associated to the user because many different users can have assigned tasks on the same list.&lt;/li&gt;
&lt;li&gt;A Team has many users and lists, and has many tasks through lists. Tasks are associated through lists because a user may leave a team, yet the list is "stuck" to the Team and will still have the task (that was formerly assigned to the user).&lt;/li&gt;
&lt;li&gt;A List has many tasks, has many users through tasks, and belongs to a team.&lt;/li&gt;
&lt;li&gt;A Task belongs to a list and (optionally) to a user (allowing for tasks to be 'unassigned'). &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Structuring the relationships this way made much more sense and allowed me to proceed with considerably less confusion and headache. &lt;/p&gt;

&lt;p&gt;I knew designing the database was (arguably) the most important part of building the MVP, but I underestimated how much time I should spend brainstorming/planning/testing my models and associations. On my next project, I'll dedicate more time to this step of the process so that subsequent steps can progress smoothly. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Routing and Sessions with Sinatra</title>
      <dc:creator>Anya Brun</dc:creator>
      <pubDate>Mon, 06 Jun 2022 22:32:31 +0000</pubDate>
      <link>https://dev.to/tsbrun/routing-and-sessions-with-sinatra-45i</link>
      <guid>https://dev.to/tsbrun/routing-and-sessions-with-sinatra-45i</guid>
      <description>&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: I wrote this blog post some time ago for Phase 2 of my Flatiron School SE program.&lt;/p&gt;

&lt;p&gt;Rubber-ducking doesn't just work for debugging. One of the best ways to learn is to teach others. Doing so can help you solidify your understanding of new/difficult concepts. In fact, there's even a fancy German term for it--&lt;a href="https://en.wikipedia.org/wiki/Learning_by_teaching"&gt;&lt;strong&gt;Lernen durch Lehren&lt;/strong&gt;&lt;/a&gt;. That's how you know it's legit. &lt;/p&gt;

&lt;p&gt;Two new concepts I learned in the Sinatra project phase of my Flatiron course were routing and sessions. Since they were a bit difficult for me to wrap my head around, what better way to make sure I understand them than to teach the nebulous void of the interwebs? &lt;/p&gt;

&lt;h2&gt;
  
  
  What is Routing?
&lt;/h2&gt;

&lt;p&gt;Routing is basically the method / process by which resources are sent to browser clients in response to HTTP requests. This process can be explained with the request/response cycle.&lt;/p&gt;

&lt;p&gt;Let's take my Sinatra Plot Manager app as an example.&lt;/p&gt;

&lt;p&gt;First, the user types the url of the resource they want--say... the plot of their sci-fi WIP, "Robots in Space"--into the browser. Next, the browser client builds a request based on that url and addresses it to the correct server (i.e., the server hosting my app). &lt;/p&gt;

&lt;p&gt;Requests contain 1) a path that specifies the requested resource and 2) an HTTP verb that indicates what the server should do with the response. In this instance, the verb would be GET--instructing the server to retrieve (or, 'get') the Robots in Space plot resource and send it to the client. &lt;/p&gt;

&lt;p&gt;Get it? &lt;em&gt;wink, wink&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The router--wherever in the app you've defined routes, like config/routes.rb--processes the request and maps it to the correct controller and action (get '/plots/robots-in-space' in the PlotsController). The action receives the request and passes it to the view, which subsequently renders the embedded ruby (ERB) file as html. Our Plots Controller sends this response back to the browser client and it is displayed as a web page for the user.&lt;/p&gt;

&lt;p&gt;My plot manager app requires a user to login to see the resources they've created, such as plots, characters, summaries, etc. How does the server know what resources a client has access to? That's where sessions come in...&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Use Sessions?
&lt;/h2&gt;

&lt;p&gt;HTTP is stateless, so it's up to the server and client to store their own data about one another from one request to another. Clients use cookies and servers use sessions.&lt;/p&gt;

&lt;p&gt;The server sends a cookie when it responds to the client's first request. In my app, that cookie stores the user_id so that each client session has a unique identifier. The server stores a session hash that includes session data, including that user id. &lt;/p&gt;

&lt;p&gt;When the client makes requests, the app compares the id in the cookie to the id in the session to make sure the client has access to the resources they're requesting. &lt;/p&gt;

&lt;h2&gt;
  
  
  A Note on Security
&lt;/h2&gt;

&lt;p&gt;When enabling / configuring sessions within your application, Sinatra gives you the option to set a session secret. According to &lt;a href="https://martinfowler.com/articles/session-secret.html"&gt;this article by Martin Fowler&lt;/a&gt;, the session secret is "used for signing and/or encrypting cookies set by the application to maintain session state." &lt;/p&gt;

&lt;p&gt;The secret makes sure that no one can change the value of their cookies and, for example, sign into your website as an administrator and have access to sensitive information. &lt;/p&gt;

&lt;p&gt;This is why it's important to set the session secret securely, according to the guidelines in &lt;a href="https://rubydoc.info/gems/sinatra#using-sessions"&gt;the Sinatra documentation&lt;/a&gt;. Doing so involves--among other things--making sure the secret is a random number with a length of, at least, 32 bytes and storing that secret in an environment variable.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>A little bit about me</title>
      <dc:creator>Anya Brun</dc:creator>
      <pubDate>Mon, 06 Jun 2022 19:30:25 +0000</pubDate>
      <link>https://dev.to/tsbrun/a-little-bit-about-me-413f</link>
      <guid>https://dev.to/tsbrun/a-little-bit-about-me-413f</guid>
      <description>&lt;p&gt;Hello :) &lt;/p&gt;

&lt;p&gt;My name is Anya and I'm currently living in the upstate New York area. Meeting me for the first time, you'd think I'm quiet and shy. And, at least initially, that's true. However, once I get comfortable with someone (which can take a while--admittedly), my true nature is revealed and you'll be begging me to stop running my motor mouth. &lt;/p&gt;

&lt;p&gt;I've always been very curious and driven to learn and try new things. While I can get distracted by details, I'm largely a big picture person and like to have a "ground, up" understanding of concepts. &lt;/p&gt;

&lt;p&gt;Growing up, my family moved quite a bit, exposing me to a diverse array of people and cultures. We started out in the northeast, but I've lived in the sandy desert of New Mexico and the steamy beaches of the Dominican Republic. &lt;/p&gt;

&lt;p&gt;Living in so many places, I also picked up a few different languages--the strongest of which are Haitian Creole and Spanish. I can also understand written French pretty well, but I haven't practiced speaking it in a long while. &lt;/p&gt;

&lt;p&gt;In my free time, I'm more than likely:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;crocheting&lt;/li&gt;
&lt;li&gt;training for a 5k&lt;/li&gt;
&lt;li&gt;reading articles on nutrition or psychology &lt;/li&gt;
&lt;li&gt;watching Chicago Fire/PD/Med on Hulu (in that order) &lt;/li&gt;
&lt;li&gt;attempting to play bass (not well, sadly) &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My interest in programming was sparked early in my life. When I was little, my father bought my sister and I a computer game that involved hacking through a company’s computer system and piecing together evidence of corruption and corporate espionage. Later, he bought us a Raspberry Pi computer and helped us install an Ubuntu operating system.&lt;/p&gt;

&lt;p&gt;This led me to sign up for an introductory web development course in high school, wherein I learned the fundamentals of HTML and CSS. My final project was a website that displayed summaries and links to my favorite book series. I remember tinkering with a dropper tool and free graphics-editing software to get just the right gradient for the website’s background. &lt;/p&gt;

&lt;p&gt;By the time I graduated high school, I had finished a decent percentage of freeCodeCamp’s front-end development curriculum. Hence, it was an easy decision to make web development my career. I applied for Flatiron School’s software engineering program soon after graduation.&lt;/p&gt;

&lt;p&gt;During my time at Flatiron School, I developed skills in Ruby on Rails, JavaScript, React.js, and Redux.js through a series of project-based modules. Debugging was often my favorite aspect of completing the portfolio project. I would get stuck on a seemingly impossible bug and spend hours (even days) scouring the internet for answers. At last, I would find it–a blog post, a pull request on Github, a reply to a Stack Overflow question, or some example code in the documentation–that helped me understand the problem and craft a solution. &lt;/p&gt;

&lt;p&gt;Currently, I am working on building a solid foundation in computer science fundamentals by studying data structures and algorithms. I am also expanding and strengthening my project portfolio in order to better showcase my skills and to gain experience in user-interface design and front-end technologies, like Node.js. Eventually, I want to learn Swift and get into developing iOS applications.&lt;/p&gt;

&lt;p&gt;Feel free to connect with me through the comments or on &lt;a href="https://www.linkedin.com/in/tsephanya-brun-2793061a7/"&gt;LinkedIn&lt;/a&gt; if you want to share your latest projects, 5k training plans, book recs, or anything in between. &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>devjournal</category>
      <category>writing</category>
    </item>
    <item>
      <title>My misadventures with the useSelector hook</title>
      <dc:creator>Anya Brun</dc:creator>
      <pubDate>Fri, 03 Jun 2022 16:47:28 +0000</pubDate>
      <link>https://dev.to/tsbrun/my-misadventures-with-the-useselector-hook-5gdl</link>
      <guid>https://dev.to/tsbrun/my-misadventures-with-the-useselector-hook-5gdl</guid>
      <description>&lt;p&gt;One of the more interesting aspects of completing my React/Redux project was learning about the mechanics of state. &lt;/p&gt;

&lt;h2&gt;
  
  
  What is state and why did I need it?
&lt;/h2&gt;

&lt;p&gt;React &lt;strong&gt;state&lt;/strong&gt; is a JavaScript object that contains information that is private and fully controlled by the component. The Redux library allows for a global application state. Instead of (or, sometimes, in conjunction with) each component's local state, there is one object that contains all the state for the application. This object is located in the Redux &lt;strong&gt;store&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;I decided to use Redux Toolkit to help set up the global state of my application. While all the information contained in the state is located in the store, an individual component may not need the entire state object, but only a piece of the information it contains. &lt;/p&gt;

&lt;p&gt;Redux Toolkit conceptualizes these "pieces of state" as &lt;strong&gt;slices&lt;/strong&gt; and provides the &lt;code&gt;createSlice&lt;/code&gt; function as a way to assemble the application state one slice at a time. Slices are organized by the different features of the application, so that each slice contains only the initial state that is relevant to a specific feature. &lt;/p&gt;

&lt;p&gt;Physically organizing the slices that make up &lt;code&gt;state&lt;/code&gt; into features helped me understand what information was better stored in local vs. global state. This separation also made it easier to visualize the discrete steps of each feature and the corresponding actions + reducers I needed to write.&lt;/p&gt;

&lt;p&gt;When it comes down to using data from the global state, it is best practice to write selector functions. The React-Redux library provides the &lt;code&gt;useSelector&lt;/code&gt; hook, allowing you to use the selector function within a component. The selector takes &lt;em&gt;the entire Redux store state&lt;/em&gt; as its argument, reads (and/or derives) some value from the state, and returns the result. According to the &lt;a href="https://redux.js.org/style-guide/#keep-state-minimal-and-derive-additional-values"&gt;Redux docs&lt;/a&gt;, using selector functions keeps state minimal and easy to read, while making sure that original state is not being replaced. &lt;/p&gt;

&lt;h2&gt;
  
  
  How did I implement state?
&lt;/h2&gt;

&lt;p&gt;In my React/Redux app, the two major features, for which I need access to the global store, are loading the levels on the Home page and letting users submit their own levels.&lt;/p&gt;

&lt;p&gt;To implement these features, I created two slices: &lt;code&gt;levelsSlice.js&lt;/code&gt; and &lt;code&gt;formSlice.js&lt;/code&gt;. The former GETs game levels from the API and stores them in the &lt;code&gt;state&lt;/code&gt; object, while the latter handles POSTing user-submitted data. State is structured thus:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    levels: 
        {loading: false, hasErrors: false, levels: []},
    form: 
        {loading: false, hasErrors: false, message: ""}
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In addition to generating and exporting actions, the thunk action, and the reducer itself--I decided to create the selector functions in these files, as well. Here is the code for &lt;code&gt;levelsSlice.js&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export const levelsSelector = state =&amp;gt; state.levels 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Frankly, the levelsSlice was the first slice I created, so I relied heavily on the &lt;a href="https://redux-toolkit.js.org/introduction/getting-started"&gt;Redux Toolkit "Getting Started"&lt;/a&gt; guide. In other words, I knew what this code was supposed to do, but I didn't know how it worked. &lt;/p&gt;

&lt;p&gt;Well, this initial setup got my app to work perfectly insofar as it fetched the correct data and saved it to the store, so users could choose and play levels. &lt;/p&gt;

&lt;p&gt;My next task was to make it possible for users to submit their own levels. On to &lt;code&gt;formSlice.js&lt;/code&gt;. I more or less followed the same process for writing the thunk, the reducers, etc as in levelsSlice--with one small change:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export const formSelector = state =&amp;gt; state.message
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;My reasoning: I would need the message to display as a validation to the user, so I should read it from the &lt;code&gt;state&lt;/code&gt; with a selector.  &lt;/p&gt;

&lt;p&gt;Again, everything worked perfectly. A user could submit a hint and a word, this data would be POSTed to the API, and--upon returning to the Home page, where all the levels are displayed--the user-submitted level would appear, ready to play. &lt;/p&gt;

&lt;p&gt;However, in the console I was getting an error to the effect of &lt;code&gt;unable to deconstruct property 'message' (something, something) undefined&lt;/code&gt;. The error pointed to the following line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const { message, loading, hasErrors } = useSelector(formSelector) 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What went wrong?
&lt;/h2&gt;

&lt;p&gt;First, I compared formSlice and levelsSlice, looking for any syntactical errors I may have made that would cause the code to break. Finding none, I tried to assign each property to a constant individually and see if it was just one not being assigned properly (meaning the problem could be in one of the reducers). All three lines gave the same error. After a couple more fruitless attempts at debugging, I googled the error and looked through some Stack Overflow posts. &lt;/p&gt;

&lt;p&gt;One such post in particular (titled &lt;strong&gt;UseSelector State is Undefined&lt;/strong&gt;)--while not directly answering my question--gave me an idea that sparked my understanding of the problem (and, subsequently, its solution). A reply suggested that OP should "[a]dd a console for debugging and check the &lt;code&gt;state&lt;/code&gt; object." I did so with the following line of code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;useSelector((state) =&amp;gt; console.log(state))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thereafter, I (as expected) saw logged to the console the &lt;code&gt;state&lt;/code&gt; object, whereupon I realized my folly. &lt;/p&gt;

&lt;p&gt;I hadn't realized that the selector function accepts &lt;strong&gt;the &lt;em&gt;entire&lt;/em&gt; state&lt;/strong&gt;. In &lt;code&gt;levelsSlice.js&lt;/code&gt;, I mistakenly assumed that the &lt;code&gt;state&lt;/code&gt; object I used in the selector was the specific slice of state represented by the initial state I had defined in &lt;code&gt;levelsSlice.js&lt;/code&gt;. I must have gotten confused by the fact that the name of the slice (and, hence, the key in the global state that points to the slice's properties) was the same as the key for the &lt;code&gt;levels&lt;/code&gt; array. &lt;/p&gt;

&lt;p&gt;The line in which I deconstruct the properties &lt;code&gt;message&lt;/code&gt;, &lt;code&gt;loading&lt;/code&gt;, and &lt;code&gt;hasErrors&lt;/code&gt; returned &lt;code&gt;undefined&lt;/code&gt; because &lt;code&gt;state.message&lt;/code&gt; does not exist. What I really meant was &lt;code&gt;state.form.message&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How did I fix it?
&lt;/h2&gt;

&lt;p&gt;At this point, I understood that the actual point of the selector in &lt;code&gt;formSlice.js&lt;/code&gt; was to select the slice of state that stores the properties relevant to the form feature (i.e., &lt;code&gt;state.form&lt;/code&gt;). Using the object destructuring syntax, I can then assign the value of each of those properties to a constant in my form component. With that newfound knowledge, I refactored formSlice like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export const formSelector = state =&amp;gt; state.form
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using this selector function in the &lt;strong&gt;useSelector&lt;/strong&gt; hook would return the following object:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{ message: "", loading: false, hasErrors: false } 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And logging &lt;code&gt;message&lt;/code&gt;, &lt;code&gt;loading&lt;/code&gt;, and &lt;code&gt;hasErrors&lt;/code&gt; to console would allow me to see those values and how they change before, during, and after a user submits the form.&lt;/p&gt;

&lt;p&gt;Debugging this error was one of the more fun parts of building my project. Having recently watched the film "Murder on the Nile", I felt like Hercule Poirot, following the clues until I eventually caught the culprit and solved the mystery. Thankfully, the only thing killed in this case was time. &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>react</category>
      <category>redux</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Disable Request-Forgery Protection</title>
      <dc:creator>Anya Brun</dc:creator>
      <pubDate>Fri, 03 Jun 2022 16:47:18 +0000</pubDate>
      <link>https://dev.to/tsbrun/disable-request-forgery-protection-c42</link>
      <guid>https://dev.to/tsbrun/disable-request-forgery-protection-c42</guid>
      <description>&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: I wrote this blog post some time ago for Phase 4 of my Flatiron School SE program.&lt;/p&gt;

&lt;p&gt;While setting up the api for my project, I came across an interesting bug. Naturally, for my JS front-end to be able to make fetch requests to the Rails back-end, I needed to enable cross-origin resource sharing. Now, I'd typically just go into the CORS config file and allow all origins with the wildcard:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;# config/initializers/cors.rb&lt;/span&gt;

&lt;span class="no"&gt;Rails&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;application&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;middleware&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;insert_before&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;Rack&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Cors&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  &lt;span class="n"&gt;allow&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
    &lt;span class="n"&gt;origins&lt;/span&gt; &lt;span class="s1"&gt;'*'&lt;/span&gt;

    &lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s1"&gt;'*'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="ss"&gt;headers: :any&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="ss"&gt;methods: &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="ss"&gt;:get&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:post&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:put&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:patch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:delete&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:options&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:head&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Interestingly, I was still getting errors saying that fetch requests from my front-end were being blocked. After a great deal of googling and digging through Rails pull requests on github, I stumbled upon section 7.2 of the Action Cable Rails guide—wherein I discovered the following piece of code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;# config/environment/development.rb&lt;/span&gt;

&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;action_cable&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;disable_request_forgery_protection&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kp"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This line of code disables and allows requests from any origin. An array of strings can also be passed in to specify from which origins requests may be accepted. &lt;/p&gt;

&lt;p&gt;So enabling CORS requires not only adjusting the cors.rb file, but also going into development.rb and setting &lt;code&gt;disable_request_forgery_protection&lt;/code&gt; equal to &lt;strong&gt;true&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tangentially-related side note&lt;/strong&gt;: some time ago, I came across an article talking about the need to keep a "developer journal." For now, my developer journal is just a document with a list of errors I come across and links to articles that helped me fix them. It helps prevent the same bugs from occurring again and provides a repo of information I can dig into later for deeper understanding of certain topics.&lt;/p&gt;

&lt;p&gt;Once my backend was set up, I was able to start making AJAX requests. AJAX stands for Asynchronous Javascript And XML—although AJAX requests can be formatted as plain text or JSON. &lt;/p&gt;

&lt;p&gt;When an event occurs (e.g., pressing a button), JS creates an XMLHttpRequest object that is sent to the web server (i.e., the Rails api). The server processes the request, and sends the response which is read and acted on by JavaScript. &lt;/p&gt;

&lt;p&gt;JSON, by the way, is JavaScript Object Notation. Our Rails api "speaks" Ruby and the browser "speaks" JavaScript. Hence, the api converts Ruby objects into JSON (using serializers) before sending them to the frontend, so that the JS-speaking browser can then understand and use the data.&lt;/p&gt;

&lt;p&gt;That's a pretty simplified understanding, but it was what I needed to enable back-and-forth communication between the client-side of my application and the server.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
