<?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: Logan CoBell</title>
    <description>The latest articles on DEV Community by Logan CoBell (@lcobell).</description>
    <link>https://dev.to/lcobell</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%2F937694%2Faf95785a-1955-4b48-b6e9-7058141a27db.jpeg</url>
      <title>DEV Community: Logan CoBell</title>
      <link>https://dev.to/lcobell</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lcobell"/>
    <language>en</language>
    <item>
      <title>True or False?</title>
      <dc:creator>Logan CoBell</dc:creator>
      <pubDate>Sat, 05 Nov 2022 23:56:54 +0000</pubDate>
      <link>https://dev.to/lcobell/true-or-false-4ljj</link>
      <guid>https://dev.to/lcobell/true-or-false-4ljj</guid>
      <description>&lt;p&gt;In one of our class projects we need to be able to show whether or not a users' account is private or not.  To do this I chose to use an if/else statement and used the logical operator &amp;amp;&amp;amp; (and) to check if the user whose page we are on is private by writing&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="k"&gt;if&lt;/span&gt; &lt;span class="vi"&gt;@the_user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;private&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="s2"&gt;"false"&lt;/span&gt; 
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;dd&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="kp"&gt;true&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/dd&amp;gt;
else
    &amp;lt;dd&amp;gt;false&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;dd&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;@the_user is an instance variable in this ruby code that returns the user whose page we are currently on, private is one of the columns in our Users table from our database that stores the boolean value that we compare with "false" thus getting the correct return value. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>RRR</title>
      <dc:creator>Logan CoBell</dc:creator>
      <pubDate>Wed, 05 Oct 2022 20:19:57 +0000</pubDate>
      <link>https://dev.to/lcobell/rrr-3b1c</link>
      <guid>https://dev.to/lcobell/rrr-3b1c</guid>
      <description>&lt;p&gt;Today we learned about routing in Ruby and made our first Rails application, a remake of our Rock, Paper, Scissors game from the beginning of the course.  There are many similarities with routing in express so this was a nice review of routing concepts and MVC architecture common to many frameworks. In Ruby on Rails all of our Routes are in our config/routes.rb file and look like this&lt;/p&gt;

&lt;p&gt;get("/", { :controller =&amp;gt; "application", :action =&amp;gt; "page_you_want"})&lt;/p&gt;

&lt;p&gt;The first argument of the get method is a string ("/") in this example. &lt;br&gt;
The second argument is a Hash, in this example "page_you_want"&lt;/p&gt;

&lt;p&gt;Next we have the application_controller (Controller/Action) in this file we find the controller, below is an example&lt;/p&gt;

&lt;p&gt;render({ :template =&amp;gt; "game_templates/scissors.html.erb"})&lt;/p&gt;

&lt;p&gt;In this file we call the separate html file for the page, in this case scissors.html.erb for the basic structure of our page while embedding our logic in our application_controller.rb file. By using instance variables @variable syntax we can now use our variables in both our actual view file as well as our application_controller file making our code nice and DRY!&lt;/p&gt;

&lt;p&gt;Here is a link to my GitHub repository &lt;a href="https://github.com/Logan-s-DPI-Account/rps-rcav"&gt;RPS routing exercise&lt;/a&gt;&lt;/p&gt;

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