<?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>Forem: Cameron Youngblood</title>
    <description>The latest articles on Forem by Cameron Youngblood (@youngbloodcyb).</description>
    <link>https://forem.com/youngbloodcyb</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%2F1039109%2F35527750-ef7d-4505-a277-5391e2aa0b2b.jpeg</url>
      <title>Forem: Cameron Youngblood</title>
      <link>https://forem.com/youngbloodcyb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/youngbloodcyb"/>
    <language>en</language>
    <item>
      <title>Rake | Junior Rails Review</title>
      <dc:creator>Cameron Youngblood</dc:creator>
      <pubDate>Mon, 06 Mar 2023 04:16:19 +0000</pubDate>
      <link>https://forem.com/youngbloodcyb/rake-junior-rails-review-13cc</link>
      <guid>https://forem.com/youngbloodcyb/rake-junior-rails-review-13cc</guid>
      <description>&lt;h2&gt;
  
  
  Hi, my name is Cameron Youngblood 👋🤠
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;I write about the experience of learning Ruby on Rails from a beginner's perspective. New article each week.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;I'm currently looking for a junior Rails position!&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Follow me or shoot me a DM on Twitter → &lt;a href="https://twitter.com/youngbloodcyb"&gt;@youngbloodcyb&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  My Experience With Rake
&lt;/h3&gt;

&lt;p&gt;Not long ago, I was playing around with a Rails project that I cloned from a repo on GitHub. I’m a little embarrassed to say that it was actually my first time cloning someone else’s Rails project and running it locally. As I set it up to run on my machine, unsurprisingly, I ran into a few issues. The first one was related to some necessary Postgres configuration. Up to that point, I had primarily used the default SQLite for my local projects, so it felt like stepping into a new world. While it was initially frustrating to work through, I eventually figured out the issue and learned a ton. &lt;/p&gt;

&lt;p&gt;With Postgres finally running, I started up the rails server again and moved on to my next error: &lt;code&gt;ActiveRecord::ConnectionNotEstablished&lt;/code&gt;. After a few Google searches and lots of time, I came to the realization that I failed to setup the database and migrate the schema. On a StackOverflow thread, I read one way to resolve this was to run &lt;code&gt;rake db:setup&lt;/code&gt; and &lt;code&gt;rake db:migrate&lt;/code&gt;. I had used &lt;code&gt;rails db:migrate&lt;/code&gt; before, but this “rake” word was new to me. &lt;/p&gt;

&lt;p&gt;“Ok, whatever,” I thought. It didn’t matter that I didn’t know what it meant. I copied and pasted those two lines to the command line, restarted the server and bam, it worked. However, I still had no idea what exactly happened. My app was running, but I didn’t know what “rake” did, and that really bothered me. &lt;/p&gt;

&lt;p&gt;Based on my experience, albeit limited, I knew generally what &lt;code&gt;db:setup&lt;/code&gt; and &lt;code&gt;db:migrate&lt;/code&gt; did. However, I didn’t really know what the word &lt;code&gt;rake&lt;/code&gt; meant. I knew I had recognized it somewhere… “Where have I see this before? Oh, right!” There’s a &lt;code&gt;Rakefile&lt;/code&gt; in the root directory of every Rails app I’ve interacted with. Naturally I thought, “Maybe there will be a hint in there as to what it does.” &lt;/p&gt;

&lt;p&gt;In the default &lt;code&gt;Rakefile&lt;/code&gt; there’s a comment that says, “Add your own tasks in files placed in &lt;code&gt;lib/tasks&lt;/code&gt; ending in &lt;code&gt;.rake&lt;/code&gt;.” So, I thought, “Oh… so is &lt;code&gt;rake&lt;/code&gt; kind of like &lt;code&gt;npm&lt;/code&gt; scripts that I can write and run for a rails project?” I followed the instructions in the &lt;code&gt;Rakefile&lt;/code&gt; to the &lt;code&gt;lib/tasks&lt;/code&gt; directory to see if I could find definitions for the rake tasks that I used previously to magically fix my Rails app. I assumed maybe there were pre-defined methods such as &lt;code&gt;db:migrate&lt;/code&gt; like I used before. However, the directory was empty. So, instead, I backtracked and followed the &lt;code&gt;Rakefile&lt;/code&gt; to the &lt;code&gt;config/application&lt;/code&gt; directory. There was definitely more in there, but I sadly couldn’t grok anything from this file relating directly to &lt;code&gt;rake&lt;/code&gt; (at least as far as I could tell). &lt;/p&gt;

&lt;p&gt;At this point, the only thing I could think was, “Well, if all applications I’ve seen have &lt;code&gt;Rakefile&lt;/code&gt; in them, then &lt;code&gt;rake&lt;/code&gt; must be something that comes default with Rails. So, there must be something in the Rails Guides that explains what &lt;code&gt;rake&lt;/code&gt; is.” &lt;/p&gt;

&lt;p&gt;But I was wrong. I went to the Rails guides and searched for the work “rake” on every page I could find. While there was an occasional instance of the word, there wasn’t any explanation of what it did. Instead, the best explanation I could find was “Active Record supports using rake.” Well, I kind of figured that much, but that didn't tell me what I wanted to know.&lt;/p&gt;

&lt;p&gt;After some more digging, I came across the docs on GitHub for the rake gem itself. In an attempt to understand the commands I executed earlier (&lt;code&gt;rake db:setup&lt;/code&gt; and &lt;code&gt;rake db:migrate&lt;/code&gt;), I skimmed the &lt;code&gt;glossary&lt;/code&gt; and &lt;code&gt;command_line_usage&lt;/code&gt; files in the docs. But, to no avail, I couldn’t find anything about running database migrations using &lt;code&gt;rake&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Finally, after a while of perusing through Google search results without finding a clear answer, I found an informative &lt;a href="https://medium.com/swlh/understanding-rake-in-ruby-9eaf7f7b20cc"&gt;blog article on Medium from Emir Vatric&lt;/a&gt;. In it, he goes into some helpful detail about what rake can do and how to create rake tasks. But most helpful to me was a simple distinction between &lt;code&gt;rake&lt;/code&gt; and &lt;code&gt;rails&lt;/code&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Worth noting is that since Rails 5 core team decided to have consistency by enabling rails command to support everything that rake does. Some favor using rake over rails.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;While this didn’t clear up all the questions I had about &lt;code&gt;rake&lt;/code&gt;, it definitely helped me understand why I would often see the word &lt;code&gt;rake&lt;/code&gt; instead of &lt;code&gt;rails&lt;/code&gt;. Additionally, it helped me understand why the code I copied from StackOverflow ran without any issues.&lt;/p&gt;

&lt;p&gt;For experienced developers who have used Rails for many years, I bet it’s almost laughable to see such a simple thing completely stump someone. However, for me, a newcomer to the Rails ecosystem, it was extremely confusing. In fact, I still have so many questions. For example, why don’t I need the rake gem to be installed to be able to use the command &lt;code&gt;rake db:migrate&lt;/code&gt;? Is it better practice to use &lt;code&gt;rails db:migrate&lt;/code&gt;, or &lt;code&gt;rake db:migrate&lt;/code&gt;? Is it just preference? Do each perform the exact same actions? Are they &lt;em&gt;actually&lt;/em&gt; the same thing, or am I just misunderstanding?&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion &amp;amp; Recommendation
&lt;/h3&gt;

&lt;p&gt;Overall, my confusion on rake was not a devastating roadblock to getting an app up and running. More than anything, it was just an inconvenience. But, I would venture to say that other people learning Ruby on Rails have probably wondered or been stumped by the same thing. &lt;/p&gt;

&lt;p&gt;While one of the sources of my problem was likely me looking at outdated StackOverflow threads, I think there could be more clarification in the Rails docs addressing what &lt;code&gt;rake&lt;/code&gt; and &lt;code&gt;Rakefile&lt;/code&gt; are. As a beginner, I felt like I was going on a wild goose chase to understand what they meant. In the end, I learned a lot that I wouldn't have known otherwise. My only wish is that correct information would have been easier to find and readily available at a reliable source.&lt;/p&gt;

&lt;p&gt;Thanks for reading this first post from &lt;em&gt;Junior Rails Review&lt;/em&gt;! Feel free to follow me on Twitter. Additionally, if there was something I was missing in this post or something that was inaccurate, please reach out!&lt;/p&gt;

</description>
      <category>rails</category>
      <category>ruby</category>
      <category>rake</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Intro | Junior Rails Review</title>
      <dc:creator>Cameron Youngblood</dc:creator>
      <pubDate>Mon, 06 Mar 2023 04:02:46 +0000</pubDate>
      <link>https://forem.com/youngbloodcyb/intro-junior-rails-review-3j68</link>
      <guid>https://forem.com/youngbloodcyb/intro-junior-rails-review-3j68</guid>
      <description>&lt;h2&gt;
  
  
  Hi, my name is Cameron Youngblood 👋🤠
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;I write about the experience of learning Ruby on Rails from a beginner's perspective. New article each week.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;I'm currently looking for a junior Rails position!&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Follow me or shoot me a DM on Twitter → &lt;a href="https://twitter.com/youngbloodcyb"&gt;@youngbloodcyb&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;While I've been coding for some time, I’m relatively new to the Ruby on Rails community. My background is primarily in frontend JavaScript, but I have some amateur experience in Java, Python, and SQL. Coming to Ruby has made me love coding more than I ever have before, which is honestly something I didn’t think was possible! &lt;/p&gt;

&lt;p&gt;One of the things that drew me to Ruby in the first place was the community. What I saw from the outside looking in was a group of people who are extremely passionate about development and helping others achieve success. In the limited time I’ve spent learning this language and framework, I’ve felt immense support. The community around Rails is undoubtedly the most supportive and kindest out of any development group I’ve found. &lt;/p&gt;

&lt;p&gt;Another reason why I was drawn to Ruby was because I’ve heard consistently that Ruby and Rails make the best development experience in the world. As a beginner, this is obviously extremely appealing. I have worked with other libraries and frameworks and have thought to myself, “there has to be a better way to do this.” And, so far, I can honestly say Rails has exceeded my expectations for what a full stack framework can be.&lt;/p&gt;

&lt;p&gt;While learning Rails has been (and continues to be) a great experience, I wouldn’t say it’s the most beginner friendly framework out there. In fact, as I’ve been learning it, I can understand why many people flee to flashy JavaScript stacks. So far, I’ve had to put in much more effort to hit the ground running than I did with JavaScript. In my opinion, it’s much easier to get rolling with a Next.js app than to build out an equivalent app in Rails. But, I recognize how much more a Rails app can be with less code, and I’m willing and hungry to put in the effort to eventually master the framework.&lt;/p&gt;

&lt;p&gt;Among people learning to code, I constantly see fewer beginners even consider Ruby and Rails as an option. Even though I’m also very much a beginner, I’m hoping to do my part in revitalizing an interest in a language and framework that I’ve already grown to love. This is my primary motivation behind writing this series. By sharing my own experiences learning Rails, I hope to bring awareness to things that may be more difficult for beginners like me to grasp. &lt;/p&gt;

&lt;p&gt;By writing these articles, my intent is not to degrade Ruby, Rails, or anyone in the development community. These are simply my experiences. Throughout this series, I’m going to cover my experience learning a breadth of different topics within Rails. Some of them will be bite-sized things like specific gems, while others may be core Rails topics such as Active Record. Lastly, I just want to welcome any and all feedback. If anything I say is inaccurate, please don’t hesitate to reach out to me on Twitter and correct me! Thanks for being here, please enjoy this series "Junior Ruby Review".&lt;/p&gt;

</description>
      <category>rails</category>
      <category>ruby</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
