<?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: disanchez27edu</title>
    <description>The latest articles on DEV Community by disanchez27edu (@disanchez27edu).</description>
    <link>https://dev.to/disanchez27edu</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%2F1001349%2F27111174-9f0c-4501-b826-5f3ebd73bb80.png</url>
      <title>DEV Community: disanchez27edu</title>
      <link>https://dev.to/disanchez27edu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/disanchez27edu"/>
    <language>en</language>
    <item>
      <title>Creating Records with Associations</title>
      <dc:creator>disanchez27edu</dc:creator>
      <pubDate>Mon, 16 Jan 2023 19:35:51 +0000</pubDate>
      <link>https://dev.to/disanchez27edu/creating-records-with-associations-48of</link>
      <guid>https://dev.to/disanchez27edu/creating-records-with-associations-48of</guid>
      <description>&lt;p&gt;To create my sample data, I simply created a new set of records for each table. I included logic so that the entities that had any kind of association would be assigned a user through the necessary foreign_key.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; ## SAMPLE PHOTOS ###

  p "Creating sample photos"

  100.times do
    new_photo = Photo.create(
     owner_id: User.all.sample.id,
     caption:  Faker::Hipster.sentence(word_count: 10),
     image:   "http://www.robohash.org/"+Faker::Number.number(digits: 4).to_s
    )
  end

  p "#{Photo.count} photos created."
  p "Here's an example:"
  p Photo.all.order(id: :desc).first

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Yet in my database, those associations are not understood. Why is this?&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Methods, Symbols, Strings Pt 2</title>
      <dc:creator>disanchez27edu</dc:creator>
      <pubDate>Fri, 13 Jan 2023 19:09:01 +0000</pubDate>
      <link>https://dev.to/disanchez27edu/methods-symbols-strings-pt-2-4gh6</link>
      <guid>https://dev.to/disanchez27edu/methods-symbols-strings-pt-2-4gh6</guid>
      <description>&lt;p&gt;In building out a data model for users in a hypothetical "photogram" web app, the syntax is quite tricky!&lt;br&gt;
Why, in the code below, do we use symbols, strings, and methods at different points?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class User &amp;lt; ApplicationRecord
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :validatable

  has_many :own_photos, class_name: "Photo", foreign_key: "owner_id"
  has_many :comments, class_name: "Comment", foreign_key: "author_id"
  has_many :follow_requests_received, class_name: "FollowRequest", foreign_key: "recipient_id"
  has_many :follow_requests_sent, class_name: "FollowRequest", foreign_key: "sender_id"
  has_many :likes, class_name: "Like", foreign_key: "fan_id"
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>cloud</category>
      <category>containers</category>
      <category>javascript</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Methods, Symbols, and strings</title>
      <dc:creator>disanchez27edu</dc:creator>
      <pubDate>Sat, 07 Jan 2023 18:40:34 +0000</pubDate>
      <link>https://dev.to/disanchez27edu/methods-symbols-and-signs-2376</link>
      <guid>https://dev.to/disanchez27edu/methods-symbols-and-signs-2376</guid>
      <description>&lt;p&gt;What is the difference? How do I know when to call one vs the other? Ex case:&lt;/p&gt;

&lt;p&gt;In reformatting:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;matching_movies = Movie.all&lt;br&gt;
@list_of_movies = matching_movies.order( created_at: desc )&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;to:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;matching_movies = Movie.all.order( created_at: :desc )&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;what is the class of :desc? Why did we use it?&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Refactoring Routes</title>
      <dc:creator>disanchez27edu</dc:creator>
      <pubDate>Fri, 06 Jan 2023 22:11:02 +0000</pubDate>
      <link>https://dev.to/disanchez27edu/refactoring-routes-3l8p</link>
      <guid>https://dev.to/disanchez27edu/refactoring-routes-3l8p</guid>
      <description>&lt;p&gt;Key learning:&lt;/p&gt;

&lt;p&gt;Routes can be refactored quite simply! for example, the route&lt;/p&gt;

&lt;p&gt;&lt;code&gt;get ("/", ({ :controller =&amp;gt; "controller_name", :action =&amp;gt; "action_name"})&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;can be simplified to&lt;/p&gt;

&lt;p&gt;&lt;code&gt;root "controller_name#action_name"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Fundamentally, this works because the entire argument is just the method being applied to the hash relationship between the controller and the action.&lt;/p&gt;

&lt;p&gt;Root is a specific method that works for the index file.&lt;/p&gt;

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