<?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: Cathy Diaz</title>
    <description>The latest articles on DEV Community by Cathy Diaz (@diazc1).</description>
    <link>https://dev.to/diazc1</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%2F573846%2Fca9bb802-ac9a-4ddb-8ad8-609767d8fa31.jpeg</url>
      <title>DEV Community: Cathy Diaz</title>
      <link>https://dev.to/diazc1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/diazc1"/>
    <language>en</language>
    <item>
      <title>React-Redux flow</title>
      <dc:creator>Cathy Diaz</dc:creator>
      <pubDate>Wed, 05 Jan 2022 21:57:44 +0000</pubDate>
      <link>https://dev.to/diazc1/react-redux-flow-23jf</link>
      <guid>https://dev.to/diazc1/react-redux-flow-23jf</guid>
      <description>&lt;p&gt;The react-redux flow, how it flows from getting information from your forms to your store state.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On your form, an event handler is triggered. &lt;/li&gt;
&lt;li&gt;Once that event has been triggered, it is going to dispatch an action to the redux store.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Dispatching an action is the only way to trigger a state change. &lt;a href="https://redux.js.org/api/store#dispatchaction"&gt;dispatch(action)&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The store then, is going to run the reducer function &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Reducer function passes in state and action. Then it uses the switch statement to change between cases depending on the dispatch type. &lt;/p&gt;

&lt;p&gt;Switch statements render one component at a time when you have multiple components to render.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Switching between cases, the state will update accordingly. &lt;/li&gt;
&lt;li&gt;And finally the UI will re-render with the new updated data &lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>beginners</category>
    </item>
    <item>
      <title>Root Reducer</title>
      <dc:creator>Cathy Diaz</dc:creator>
      <pubDate>Thu, 02 Dec 2021 22:49:35 +0000</pubDate>
      <link>https://dev.to/diazc1/root-reducer-4ibe</link>
      <guid>https://dev.to/diazc1/root-reducer-4ibe</guid>
      <description>&lt;p&gt;In order to create a store for redux, you need to use the createStore method. This method takes in three arguments. One argument, the reducer, is required while the other two (initial state &amp;amp; middleware) are optional.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LLmJYqkP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5omm64c327ece09qpsjl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LLmJYqkP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5omm64c327ece09qpsjl.png" alt="create store" width="492" height="134"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Today I will be talking about the required argument, the reducer. In my project I only have one reducer but have created a root reducer in case I decide to add more reducers in the future.&lt;/p&gt;

&lt;p&gt;A root reducer is necessary when you have more than one model in your code. More than one model is more than one reducer and the create store method does not take in multiple reducers. So what needs to be done is to create a root reducer that holds multiple reducers. &lt;/p&gt;

&lt;p&gt;Here I show you how I created my root reducer using the combine reducers method. This method is what allows me to combine multiple reducers to one main reducer. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iqZuTaXA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ezkok6subvry0nutnckh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iqZuTaXA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ezkok6subvry0nutnckh.png" alt="combineReducers" width="685" height="144"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When I decide to add another model, I will simply import the file to my root reducer and add it inside my combine reducers method, right below the reducer you see there.&lt;/p&gt;

&lt;p&gt;And just like that you're able to have multiple reducers in your store. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Z5fJzZn7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/coqz0qprs83j9b5hd1la.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Z5fJzZn7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/coqz0qprs83j9b5hd1la.gif" alt="done" width="480" height="202"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>rails</category>
      <category>react</category>
      <category>redux</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Class and Constructor</title>
      <dc:creator>Cathy Diaz</dc:creator>
      <pubDate>Fri, 30 Jul 2021 20:13:51 +0000</pubDate>
      <link>https://dev.to/diazc1/class-and-constructor-2cab</link>
      <guid>https://dev.to/diazc1/class-and-constructor-2cab</guid>
      <description>&lt;p&gt;Ohh man! Just when I thought I was getting the hang of Ruby, here comes another language to learn. JavaScript. I don't know if it's because of that reason that JavaScript seemed so hard to learn or simply because my brain could not grasp the new concepts. I choose to believe it's because I felt completely drained and needed a little break to recover. &lt;br&gt;
anyways... &lt;em&gt;sings&lt;/em&gt; "I'm back and I'm better" 🗣&lt;/p&gt;

&lt;p&gt;for this project refactoring my code into a class and a constructor had me questioning my abilities. And isn't it so funny that 99.9% of the time it's something as small as a misspelled word? &lt;em&gt;(I.did.not.do.that)&lt;/em&gt; :&amp;gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The first&lt;/strong&gt; thing I did was to create a separate JS file. Since I will now be having two JS files, I went ahead and put them both in a source folder. Shown below. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zRxeP5Sr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5h18f1gj6jevb48xhsqf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zRxeP5Sr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5h18f1gj6jevb48xhsqf.png" alt="SRC JS Files"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The second&lt;/strong&gt; thing I did was link my new JS file to my index.html file using a script tag. I also had to update my current script tag from &lt;code&gt;&amp;lt;script src='index.js'&amp;gt;&amp;lt;/script&amp;gt;&lt;/code&gt; to  &lt;code&gt;&amp;lt;script src='src/index.js'&amp;gt;&amp;lt;/script&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;so far, not so bad &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Next&lt;/strong&gt; in my new JS file I create a class &lt;em&gt;Snack&lt;/em&gt; and inside that class a constructor.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QgGQ_7rU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gnslrye6sh0yrsyvwm69.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QgGQ_7rU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gnslrye6sh0yrsyvwm69.png" alt="class Snack"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The constructor contains the initial data needed to create new instances on the snack class and because I used a constructor function, I will need to pair it with the &lt;code&gt;new&lt;/code&gt; keyword which I included in my index.js file&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--m9l68agX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gb9kgo5antxnzgomnsw8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--m9l68agX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gb9kgo5antxnzgomnsw8.png" alt="New Keyword"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you are still confused on what classes and constructors do, this next paragraph really helped putting it into perspective. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What we really want to say is something like "Hey, constructor function, when you run, create a new copy of yourself, leaving the original unchanged and on that particular copy, set the properties based on the arguments passed into the function. The keyword new tells the constructor function to do exactly that. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;The &lt;code&gt;this&lt;/code&gt; keyword is used to reference the instance created.&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lastly&lt;/strong&gt;, I created a render card that would show the attributes included in the constructor with the updated user input information. &lt;br&gt;
For today, that is all. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--U5L4bQLZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zp1iybs27d14rk2dtfsv.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--U5L4bQLZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zp1iybs27d14rk2dtfsv.gif" alt="HAPPY CODING"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>codenewbie</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Omniauth Authentication with Google</title>
      <dc:creator>Cathy Diaz</dc:creator>
      <pubDate>Wed, 05 May 2021 07:00:03 +0000</pubDate>
      <link>https://dev.to/diazc1/omniauth-authentication-with-google-3pmf</link>
      <guid>https://dev.to/diazc1/omniauth-authentication-with-google-3pmf</guid>
      <description>&lt;p&gt;I have downloaded so many apps that give me the option to login using facebook. I never really gave it much thought, all I knew is that it made my life a little simpler. &lt;/p&gt;

&lt;p&gt;After working on my rails project, I now understand how developers were able to do that. With a little bit of rails magic, a little bit of code, and a little bit of patience. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--l-nrlFh_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hpkhs3nvkkkow1qh9ujg.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--l-nrlFh_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hpkhs3nvkkkow1qh9ujg.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(hehe)&lt;/p&gt;

&lt;p&gt;I started with OmniAuth by adding the appropriate gems needed to my Gemfile. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--StHq2sJ6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ixnpsflzfm0efkpc0hn9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--StHq2sJ6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ixnpsflzfm0efkpc0hn9.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once these are in your Gemfile, run:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;       bundle install 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;[OmniAuth can be set up with other websites, so these gems&lt;br&gt;
might look a little different, some examples:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://github.com/simi/omniauth-facebook"&gt;https://github.com/simi/omniauth-facebook&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/omniauth/omniauth-github"&gt;https://github.com/omniauth/omniauth-github&lt;/a&gt;
]&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;From here, I went to my config/routes.rb file and added the line of code below &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  get '/auth/:provider/callback', to: 'sessions#omniauth'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The best way I can explain this is by letting someone else explain it. 😅&lt;/p&gt;

&lt;p&gt;"Now let’s return to the Callback URL. This is the URL &lt;br&gt;
   where a user will be redirected to inside the app after &lt;br&gt;
   successful authentication and approved authorization &lt;br&gt;
   (the request will also contain user’s data and token). &lt;br&gt;
   All OmniAuth strategies expect the callback URL to equal &lt;br&gt;
   to “/auth/:provider/callback”. :provider takes the name &lt;br&gt;
   of the strategy (“twitter”, “facebook”, “linkedin”, &lt;br&gt;
   etc.) as listed in the initializer."&lt;/p&gt;

&lt;p&gt;In case anyone is interested in reading more: &lt;br&gt;
&lt;a href="https://www.sitepoint.com/rails-authentication-oauth-2-0-omniauth/"&gt;https://www.sitepoint.com/rails-authentication-oauth-2-0-omniauth/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next.&lt;br&gt;
In my config/initializers/omniauth.rb&lt;br&gt;
I registered a new provider, google, by providing a key pair that will identify the app to the provider.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0PkV4mBa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zgpco9wqlgd9irlf2hdm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0PkV4mBa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zgpco9wqlgd9irlf2hdm.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The two keys "GOOGLE_CLIENT_ID" and "GOOGLE_CLIENT_SECRET" are then saved in an .env file which I stored in a .gitignore file to keep them from being pushed to my GitHub. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The website I added right above also explains how to get &lt;br&gt;
   these keys from different apps&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Lastly, in my views/sessions/login.html.erb &lt;br&gt;
I add the button necessary to let my user sign in using their Google account. Show below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5OjvYkOi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i7lj1v20v9y7u0roie8q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5OjvYkOi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i7lj1v20v9y7u0roie8q.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And &lt;strong&gt;TADAHHHH✨&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aVVsMk5z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xitzqky2bkqscqcfyi76.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aVVsMk5z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xitzqky2bkqscqcfyi76.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  &lt;em&gt;I have a working login from another provider&lt;/em&gt;
&lt;/h6&gt;

</description>
      <category>omniauth</category>
      <category>googleconsole</category>
      <category>beginners</category>
      <category>rails</category>
    </item>
    <item>
      <title>I Finally Finished My First Website!</title>
      <dc:creator>Cathy Diaz</dc:creator>
      <pubDate>Tue, 06 Apr 2021 22:57:02 +0000</pubDate>
      <link>https://dev.to/diazc1/i-finally-finished-my-first-website-3mdb</link>
      <guid>https://dev.to/diazc1/i-finally-finished-my-first-website-3mdb</guid>
      <description>&lt;p&gt;After what feels likes forever to me, I finally finished my Sinatra Project. I can finally say I have OFFICIALLY made my first website, how exciting is that!   &lt;/p&gt;

&lt;p&gt;The idea behind my website is that the user loves to travel so they have a bucket list of all the places that they want to travel to. So on the website, they create their account and are allowed to create travel destinations that they wish to go and can take notes on those specific places. The notes include the name of the destination, a description of that place, and a rating from 1 to 5 stars. Once they have traveled to that place they can either edit it to say they have checked it off of their bucket list or can simply delete the place from the list. &lt;/p&gt;

&lt;p&gt;I started my project by creating migrations to create my schema. One of the migrations I ran was&lt;br&gt;
rake db:create_migration NAME=create_travel_destinations.rb &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZLlh7rSO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zashgo0v73ztrl5u7fzx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZLlh7rSO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zashgo0v73ztrl5u7fzx.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, in this file I used the create_table method to create my travel_destinations table with columns called location, description, rating, and user_id. &lt;/p&gt;

&lt;p&gt;I then continued on with my models. I create my classes and had them inherit from ActiveRecord::Base. The last thing I do in the class is give them Active Record Associations. &lt;br&gt;
Now that was the easy part. Creating the controllers and views files is where all the fun is at. &lt;/p&gt;

&lt;p&gt;Here I show my application controller, which is also the parent controller (or we can say, the main one). &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---kHoOIkA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yv3vfecygwe79xfybiel.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---kHoOIkA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yv3vfecygwe79xfybiel.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In my parent controller, I have a configure block that is used to make sure my views or erb files will show, that the data for a specific user is saved by enabling sessions, and finally set those sessions secret by using an ENV file that contains an intricate string. I also render my welcome page here, although if I wanted I could also add it to one of my other controllers. Instead of setting my routes and rendering my erb files here, I simply have helper methods to make the rest of my code more DRY. &lt;/p&gt;

&lt;p&gt;DRY: DON'T REPEAT YOURSELF&lt;/p&gt;

&lt;p&gt;As long as my helper methods are created in the parent controller and all the other controllers inherit from the parent controller, the helper methods can be used. Making my code for CRUD more DRY. &lt;/p&gt;

&lt;p&gt;CRUD: CREATE, READ, UPDATE, DELETE &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iOHGVHLm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g2we9nft3tgtfi09fjs8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iOHGVHLm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g2we9nft3tgtfi09fjs8.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here I am showing my READ all route. It has my helper method redirect_if_not_logged_in and right below that I set an instance variable equal to the current user and all travel destinations. Which then is rendered to the erb file travel_destinations/index. &lt;/p&gt;

&lt;p&gt;The last thing I want to mention is that the erb file will be what the user can see in the browser through forms that will require their input. Anything that I want the user to see will be set in html code and/or erb tags to see or evaluate ruby code. &lt;/p&gt;

&lt;p&gt;Finishing this project was tough, but it only made me feel that much closer to getting to the finish line. &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>html</category>
      <category>sinatra</category>
      <category>crud</category>
    </item>
    <item>
      <title>Building a CLI with an API✨</title>
      <dc:creator>Cathy Diaz</dc:creator>
      <pubDate>Tue, 02 Mar 2021 01:38:23 +0000</pubDate>
      <link>https://dev.to/diazc1/building-a-cli-with-an-api-4d89</link>
      <guid>https://dev.to/diazc1/building-a-cli-with-an-api-4d89</guid>
      <description>&lt;p&gt;Building a CLI from scratch has been a headache and a blessing at the same time. I now understand more about coding and feel 100% more comfortable with continuing on with this journey. But let me tell you, it didn’t come easy. I spent days working on this project, thinking, how will I ever graduate in five months if I can’t even understand the beginning concepts, but as the time passed and I went over the material more and more, it all became easier. I would find myself saying “ahhhhh” more often. Like a 💡 went on and it all finally made sense.&lt;/p&gt;

&lt;p&gt;Something I originally had trouble with was metaprogramming. In Wikipedia, this is defined as a programming technique in which computer programs have the ability to treat other programs as their data. In other words, metaprogramming is the practice of writing code that writes code for us. Making it easier to work with our programs.&lt;/p&gt;

&lt;p&gt;For example, if we take a look at the codes below, we can see the difference between not using and using metaprogramming.&lt;/p&gt;

&lt;p&gt;The first image shows how you can create attribute accessors of the data you want your objects to have. You then would initialize with those attribute accessors (creating writer and reader methods) and save the instance. It then shows how you would shovel that instance method into the @@all array.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MLgy4Q4S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yy0gfcmktp9vt5ekfzsb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MLgy4Q4S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yy0gfcmktp9vt5ekfzsb.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see below, metaprogramming is used to create easier and more manageable code. Here you can initialize with a hash and iterate over that hash using the #each method to return the key and value of that hash. Then using the method #send to create the key of the attributes named and their value.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dMUAtowO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ata29xfc71f4kvr7sk2h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dMUAtowO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ata29xfc71f4kvr7sk2h.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Coding this way is better in the long run because I can always return to this section to get the values I am essentially looking for. It makes managing my API easier  by creating new objects using that hash.  &lt;/p&gt;

&lt;p&gt;The last thing I want to mention is that using the concept of separations of concerns has been a life saver. It makes your code so much easier to read and handle. It is having a file that only deals with your CLI, a file that only deals with your API, having a file that only deals with your objects, and having a file that only deals with your execution code and another for your required environment. &lt;/p&gt;

&lt;p&gt;You know when you want to execute your code you place that in your run file. And it's the same concept for all your other files. &lt;/p&gt;

&lt;p&gt;In order for code to become easier, practice, practice, practice. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Why Software Engineering?</title>
      <dc:creator>Cathy Diaz</dc:creator>
      <pubDate>Sun, 14 Feb 2021 10:32:24 +0000</pubDate>
      <link>https://dev.to/diazc1/why-software-engineering-3654</link>
      <guid>https://dev.to/diazc1/why-software-engineering-3654</guid>
      <description>&lt;p&gt;Beginning a new career is never easy. You need to be determined to learn new skills and dedicated to contributing many hours to learn this new skill. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wCAp7mKO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/k3uuii9ummxr0ao6v8ae.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wCAp7mKO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/k3uuii9ummxr0ao6v8ae.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My next career move, I wanted it to be something I enjoyed doing. I had no idea what it was that I wanted to do. I was working full-time and going to school, but I wanted something different, I wanted to be challenged. I was going to the University of Nevada, Las Vegas and needed one more year to finish and get my degree in Business Administration, Information Management but that did not stop me from taking this leap in faith. &lt;/p&gt;

&lt;p&gt;While I was attending UNLV, I had a course on JAVA. I was so intrigued and interested. That's the first time, I decided that my end goal would be a career in the coding industry. Before that, I had never had any experience with coding, but it was a game changer. &lt;/p&gt;

&lt;p&gt;I kept going to school because I thought that was the right path to get to where I wanted to get but I quickly realized that there were other, better methods to get there. &lt;/p&gt;

&lt;p&gt;One day I was scrolling through TikTok, an online app, and I saw a video of this girl talking about Flatiron School. She had no previous experience and within five months she knew enough to start a new career. It was then, when I had to make the decision between attending the new school or staying in the same one. &lt;/p&gt;

&lt;p&gt;I was a hard decision, but after going back and forth with myself for days, I finally decided to leave UNLV and attend Flatiron School. It has been two weeks now, and it's been intense, but I always remind myself that today I know more than I did when I started. I'm excited to keep learning more, to the finish line! &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kfbEsaP4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/hg9r90yjlbaogdkg0uhk.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kfbEsaP4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/hg9r90yjlbaogdkg0uhk.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

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