<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Elise Sadsad on Medium]]></title>
        <description><![CDATA[Stories by Elise Sadsad on Medium]]></description>
        <link>https://medium.com/@elise041294?source=rss-c6936258e151------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*vj6HIFx5y8ktwR3aNETGJw.png</url>
            <title>Stories by Elise Sadsad on Medium</title>
            <link>https://medium.com/@elise041294?source=rss-c6936258e151------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 11:10:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@elise041294/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Ruby on Rails: CRUD]]></title>
            <link>https://medium.com/@elise041294/ruby-on-rails-crud-6f0641202db2?source=rss-c6936258e151------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f0641202db2</guid>
            <dc:creator><![CDATA[Elise Sadsad]]></dc:creator>
            <pubDate>Tue, 05 Jul 2022 16:44:43 GMT</pubDate>
            <atom:updated>2022-07-06T16:06:40.493Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*xQFYF5HUlVRz4P2xmFFABw.png" /></figure><p>In phase 4 project of bootcamp in Flatiron, we learned how to use the CRUD operations in building web applications. This is commonly use in web development and it stands for: Create -Read -Update -Delete.</p><p>In this blogpost, we will look at this operations individually and test their functionality in postman. Once we have already started creating our application, the next step is to create our models and controllers, and fortunately, this can be done in a real time-saving way. All we have to do us run rails g resource command with the name of your models with the specified columns and their data type. And this will create our models, controllers, serializers and routes needed. The next step is to create the seed data. Then run rails db:migrate and db:seed in your terminal, and we have the backend of your app set up.</p><p>We can now do our CRUD operations, to look at this closely, we can look at the project we made — the dinder app. This is a tinder app clone, but for delicious looking food.</p><p>Create</p><p>This will create the table in our SQLite database based on what is in our db/migrate/</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*GXiHe4lWqjWThafjX-N_SA.png" /></figure><p>And in postman,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vUEx6UI4ly95qhVnguHsVw.png" /></figure><p>Read</p><p>We add a show method where we need to find the user associated with the params id and store it in a variable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*Pzi2AOXRCH2ROT90Ms3WDw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/464/1*DWnC0fbjJcDBNcP_m-aeiw.png" /></figure><p>In this, we used the serializer that allows us to specify the data we send back to the client appropriately.</p><p>When testing your CRUD actions in postman, it is recommended that you save every actions if you know that it is already working, that way you can go back to them and can retest if needed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4DxQtj_J2hP963pvWGk91Q.png" /></figure><p>Update</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/505/1*lS9RieBMSfvWIsriFM5pMw.png" /></figure><p>This will update specific details to our existing userMeal, by specifying the specific id. When testing it functionality in postman, make sure that you past in the params needed to be updated in the body, choose raw and JSON.</p><p>Lastly, we have the delete operation,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/1*B_HbsXeBfHL3d85URKn2Xg.png" /></figure><p>In this case, we add an if statement, so that we only delete if usermeal exist, and if not do nothing. Again, when testing this on postman, we need to specify the id of the data we want to delete</p><p>To understand what how this really works:</p><p>When the browser sends a request to the server, rails gets the request and follows what method was listed (get, pots, patch or delete). And then tries to find and match it with the appropriate route. Once the correct route is found, it maps to the appropriate method in the controller and calls on that. From there, it finds the associated view page (index, show, create, update and destroy) with that method to display the results to the user.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f0641202db2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your Favorite Active Record Methods]]></title>
            <link>https://medium.com/@elise041294/your-favorite-active-record-methods-26e1d44e6b94?source=rss-c6936258e151------2</link>
            <guid isPermaLink="false">https://medium.com/p/26e1d44e6b94</guid>
            <category><![CDATA[methods]]></category>
            <category><![CDATA[activerecord]]></category>
            <category><![CDATA[beginers]]></category>
            <dc:creator><![CDATA[Elise Sadsad]]></dc:creator>
            <pubDate>Tue, 07 Jun 2022 15:58:28 GMT</pubDate>
            <atom:updated>2022-06-07T15:58:28.771Z</atom:updated>
            <content:encoded><![CDATA[<p>In this blog, we are going to discuss some of the most useful query methods you can use as you start learning Active Record. These might even become your favorite ones, why? Simply because they are short lines of code and are very easy to use. To be able to look at these methods more closely, we will use the data we use from a project where we built a Donut shop with their names, descriptions and delicious looking images as attributes.</p><p>The first one is the <strong><em>pluck</em></strong> method. This method returns an array of the values for the specified attribute columns. That’s right, if you’ve been familiar with mapping, or looping through to select a specific data. Your coding life now just became easier. So how do you use it ?</p><p>You simply do <strong><em>.pluck</em></strong><em> </em>on a class and pass in the column names within the parameters. In the example below, you can see that when we pass in the name and description parameters, we are given the array of the delicious Donut names and their descriptions:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*DvU_pyLcWsRMGsoLf0r8MQ.png" /></figure><p>Now what if you want the list of donuts to be a little bit more organized? In this case, we can use the .<strong><em>order </em></strong>method. When calling this method on a class, you can pass the argument to which attribute you want to be in a specific order. Which in this example would be the name of the donuts in alphabetical order.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*T4hl_e_1Ac3FCH7JzTjazA.png" /></figure><p>Ascending is the default for the ordering method, but if we want to see the Donut name list the other way around, we can just set the Donuts in descending order like so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*UVJVB8PQ67h9TIu11Uwz1w.png" /></figure><p>Next, we have the .<strong><em>group </em></strong>method which can be used to group items based on the attribute column and will return unique instances based on that specified attribute column. Again, we can call this on our Donut class and pass in the column name, we want to group by in parameters. To make this more useful, we can use this with <strong><em>.count</em></strong> which will return the distinct value of the called upon attribute column.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/301/1*KXreqBNOA4Xi2TCngfnhfA.png" /></figure><p>Lastly, we have the .<strong><em>select</em></strong> method which selects specific attribute columns and returns an instance. This can be used on a class selecting the specific columns within the parameters. With this we can use the <strong><em>.distinct</em></strong> method to get rid of duplicates. Note that this will not delete the duplicates from our database but will only return the unique values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*slRL3UijNOXG4s5s4mVhdQ.png" /></figure><p>There you have it, these are just few of the useful methods you may use when building your API. Once you’ve learned how to use one of these, you may find yourself using consistently. To check out more of these methods you can go visit <a href="https://guides.rubyonrails.org/active_record_querying.html">https://guides.rubyonrails.org/active_record_querying.html</a> .</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=26e1d44e6b94" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Styling in React]]></title>
            <link>https://medium.com/@elise041294/styling-in-react-33bb7e9965f7?source=rss-c6936258e151------2</link>
            <guid isPermaLink="false">https://medium.com/p/33bb7e9965f7</guid>
            <category><![CDATA[styling]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[beginners-guide]]></category>
            <dc:creator><![CDATA[Elise Sadsad]]></dc:creator>
            <pubDate>Wed, 18 May 2022 06:02:51 GMT</pubDate>
            <atom:updated>2022-05-18T06:02:51.041Z</atom:updated>
            <content:encoded><![CDATA[<p>If you have started building an app, you may have already played around with styling in React. Deciding the every small details from how thick the borders should be to picking the perfect color or font to use can be tedious but fun at the same time. Through the way the application looks, we improve user experience.</p><p>In this blog, we are going to reference our React project, which is a recipe book app called Break an Egg! This app is all about eggs, where you can search for egg recipes and share your own recipes. The design itself is pretty simple, but knowing the basic methods to start will make you want to keep designing and will help you improve your styling skills. So, let’s look at the different methods that can be used in styling a React app.</p><p>The first method is the CSS Modules, which is a .css file that is compiled. To use this, you add the className as an object as JSX with the name you want on your CSS file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/501/1*OJowgjc18sYPYzycdMBPog.png" /></figure><p>And in your CSS file, you can just add the styling you want for that specific component and the className object will map the CSS name. It’s that simple, but one thing to note is that classes are only available within the component where they are used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/358/1*5NB8Z9Vj6e17NaK6pyTFpg.png" /></figure><p>Second, we have the Inline styling — just like in basic HTML , in React we can also add CSS inline. In Break an Egg app example, the inline styles can be added to the React component like so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ED83zKv3v0m2TlCd7t69nQ.png" /></figure><p>Here we see that we added the style in inside a the div tags as a return for our MainContainer component. Note that they are written inside two curly brackets. This is because to use JavaScript expressions in JSX, they have to be included in curly brackets. The first curly bracket injects JavaScript into JSX and the inner curly brackets creates an object literal. These are then pass as objects to the element style. Because we are passing this as objects, another note to remember is that the properties should be separated by comma and the attributes are written in camelCase and not separated by a dashes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*XBM4sy_nZiG3nh886BB6zQ.png" /></figure><p>Lastly, we have the styled-components. With this, we can create a normal React component and have the styles attached to it. Which means we do not have to map over to the CSS files. In this, with this we will need to install and import style components in React app’s directory and we can start using it right away.</p><pre>$ npm install --save styled-components</pre><pre>import styled from &#39;styled-components&#39;;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/345/1*NoFydRJbrV0YloDAZgBrsg.png" /></figure><p>You can see that we created this a component and are now using pure CSS in a JavaScript file. With this, you can now pass it to different components in your app as needed.</p><p>Now, we have seen different methods that can be used in styling in React. Pretty simple but useful methods that will help in improving user experience when interfacing with the app.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=33bb7e9965f7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Events Listeners in JavaScript]]></title>
            <link>https://medium.com/@elise041294/events-listeners-in-javascript-3aadb03abc68?source=rss-c6936258e151------2</link>
            <guid isPermaLink="false">https://medium.com/p/3aadb03abc68</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[js-eventlistener]]></category>
            <dc:creator><![CDATA[Elise Sadsad]]></dc:creator>
            <pubDate>Mon, 25 Apr 2022 04:36:02 GMT</pubDate>
            <atom:updated>2022-04-25T06:54:47.651Z</atom:updated>
            <content:encoded><![CDATA[<p>Do you ever wonder what happens behind the scenes when a user clicks on a button in the web browser? One of the coolest things that Javascript can do is make something happen when a user clicks an element in the browser. In this blog post, we will take a look at how JavaScript would handle such an event. This won’t be an in-depth post, just a simple understanding of how this works and is used.</p><p>When the user clicks, the system produces a signal and provides a mechanism by which an action can be invoked. The addEventListener method is what can make this happen. And it could be used to tell JavaScript which event or events we want it to listen to.</p><p>Let’s look at a simple example of how this works. In this example, we have a single button, which, when clicked, an alert will show the message “Hello, I’ve been clicked”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/123/1*o6bAs6l8l9cyxIhaH8xKHQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/449/1*p2FTz_V2ZV0tVdoSBYCzpw.png" /></figure><p>First, create a button tag in HTML, then set the text value to Click Me!. Also, don’t forget to add the script tag to link to your index.js file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/1*3DZjT7cYMFMioyL_jmkPRA.png" /></figure><p>Second, in JavaScript file we store a reference to this button element using a query selector, and then we can assign this to a variable named button. We can now add an event listener that takes at least two arguments. The first argument would be the type of event, which in this case is “click”. The second is the function we want to call when the event occurs. In this case, it will alert “Hello, I’ve been clicked”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/423/1*qDmm5CQ4nMLcXqNZYupKlQ.png" /></figure><p>It is simple as that, try this in your VScode and you will get an alert every time the button in the browser is clicked. Event listeners are one of the best ways to have DOM interaction. There are still many types of events that can be used and learning how to use them in Javascript will really come in handy. And now you at least know one of them; the cool concept of mouse clicking and adding event listeners in JavaScript.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3aadb03abc68" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>