<?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: FigueroaR</title>
    <description>The latest articles on Forem by FigueroaR (@figueroar).</description>
    <link>https://forem.com/figueroar</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%2F286340%2F09059beb-3723-4eeb-bf1f-286ace991c3d.jpeg</url>
      <title>Forem: FigueroaR</title>
      <link>https://forem.com/figueroar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/figueroar"/>
    <language>en</language>
    <item>
      <title>Ruby, Videosgames &amp; DrangonRuby Engine</title>
      <dc:creator>FigueroaR</dc:creator>
      <pubDate>Tue, 18 Aug 2020 16:47:56 +0000</pubDate>
      <link>https://forem.com/figueroar/ruby-videosgames-drangonruby-engine-l70</link>
      <guid>https://forem.com/figueroar/ruby-videosgames-drangonruby-engine-l70</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2fsFLuL2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mfh3sbh6iqlvpglew8rv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2fsFLuL2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mfh3sbh6iqlvpglew8rv.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As part of ongoing research on Ruby, I wanted to know what was possible with Ruby, to what extend we can push the language and the outcomes. Along with researching Ruby, I researched other languages like Python, Java, JavaScript, and C along with C++. There are many game engines for Ruby like: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; Gosu&lt;/li&gt;
&lt;li&gt; Shoes&lt;/li&gt;
&lt;li&gt; ruby 2d&lt;/li&gt;
&lt;li&gt; gioco&lt;/li&gt;
&lt;li&gt; rubygame&lt;/li&gt;
&lt;li&gt; gamebox &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;check out the &lt;a href="https://www.ruby-toolbox.com/categories/game_libraries"&gt;ruby toolbox&lt;/a&gt; to learn more about each library. &lt;/p&gt;

&lt;p&gt;Although we have many libraries for Ruby, there has not been many popular games released. We have to understand why. Most games on consoles or mainstream games have dedicated engines. Example: &lt;a href="https://www.ea.com/frostbite"&gt;Frostbite Engine &lt;/a&gt; &amp;amp; &lt;a href="https://unity.com"&gt;Unity&lt;/a&gt; are built with &lt;em&gt;c++&lt;/em&gt; . These two engines are extremely powerful.&lt;/p&gt;

&lt;p&gt;Of all the ruby engines, &lt;a href="https://dragonruby.itch.io/dragonruby-gtk"&gt;DragonRuby&lt;/a&gt; seems to be the most developed well executed, easy to understand engine. Some game were released in the &lt;a href="https://apps.apple.com/us/developer/amirali-rajan/id736683064"&gt;App store&lt;/a&gt; for IOS and now Nintendo Switch. &lt;/p&gt;

&lt;p&gt;It is a difficult task to build a Ruby Engine, Amirali Rajan explains why in this &lt;a href="https://youtu.be/o0d4sjcUfCg"&gt;video&lt;/a&gt;. Essentially, we need low level computing languages to build a structure that can then be manipulated by a high-level language like Ruby. &lt;/p&gt;

&lt;p&gt;So, what’s next? Does time mean there will never be a powerful engine like &lt;a href="https://www.ea.com/frostbite"&gt;Frostbite Engine &lt;/a&gt; or &lt;a href="https://unity.com"&gt;Unity&lt;/a&gt; for ruby? There is a glimmer of hope. &lt;br&gt;
Ruby was never meant to be fast; it was meant to make the developers happy, but slowly and surely ruby has gotten faster. With the release of Ruby 3 (or 3x3), Ruby claims to be 3 time faster than Ruby 2.0. Ruby 3.0 is expected to be released Q4, 2020, however it is not set in stone.  This leads me to believe we could have a bright future for development for be it, mobile apps, or game application with Ruby. I cannot foresee the future, but I only hope this user-friendly (Ruby) language gets the push that it needs. &lt;/p&gt;

</description>
      <category>ruby</category>
      <category>gamedev</category>
      <category>motivation</category>
    </item>
    <item>
      <title>Mobile Apps &amp; Ruby</title>
      <dc:creator>FigueroaR</dc:creator>
      <pubDate>Sun, 05 Jul 2020 20:15:42 +0000</pubDate>
      <link>https://forem.com/figueroar/mobile-apps-ruby-fai</link>
      <guid>https://forem.com/figueroar/mobile-apps-ruby-fai</guid>
      <description>&lt;p&gt;During my journey studying &amp;amp; learning Ruby, to my surprise, Ruby is a beautiful user-friendly language as many of you have come to realize and love! Like any specific field of study, we come across difficult concepts to master. With programming, be it any programming language, our thought process changes. Currently when I look at projects/objects in life, I no longer take them for granted, I now see the mind that built and engineered the idea. I have an appreciation for the mind and our seemingly endless capabilities.&lt;/p&gt;

&lt;p&gt;For this reason, when I looked at website and mobile apps, I see the strenuous work that went behind it to make it come alive. This led me to ask myself more about mobile applications and how they work. I researched how to develop mobile apps and what it takes to create one. From the device OS, native OS programming language, cross platforms programming language (how to build apps for multiple Devices with one language), to how can ruby be implemented to build mobile apps.&lt;/p&gt;

&lt;p&gt;I have good and bad news:&lt;/p&gt;

&lt;h1&gt;
  
  
  The Good
&lt;/h1&gt;

&lt;p&gt;There is a method of developing mobile apps that has come to the forefront compared to other alternatives for Ruby, It is called Ruby Motion. This is a cross-platform native app builder, if you don’t realize how big a deal that is…. let me explain bit further! We can build apps for Android &amp;amp;&amp;amp; IOS at the same time with one build. Yes, there are other cross platforms like React (which requires learning JavaScript) &amp;amp; Flutter (which requires learning Dart programming language). Ruby Motion is built specifically for Ruby. Personally I love Ruby for its easy of programing. Ruby Motion has a slack channel to stay up to date with any ongoing.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Bad
&lt;/h1&gt;

&lt;p&gt;Ruby Motion is for development on OS X (Mac Desktops) only, Windows and Linux developers miss out on the fun. This will hurt Ruby Motion on the long term. Ruby Motion has a real shot at becoming adopted in mass if they include other OS systems. I hope to see them expand, Ruby is a beautiful user-friendly language and future developers will have fun with this cross-platform app builder. Meanwhile Ruby Motion has a slack channel to stay up to date with any ongoing.&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>android</category>
      <category>ios</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Why I like restful routing</title>
      <dc:creator>FigueroaR</dc:creator>
      <pubDate>Sat, 13 Jun 2020 01:12:32 +0000</pubDate>
      <link>https://forem.com/figueroar/why-i-like-restful-routing-l2c</link>
      <guid>https://forem.com/figueroar/why-i-like-restful-routing-l2c</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fXh9ZhLE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/2692/1%2Apv-pmMPED1XuTtWlHd6b1g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fXh9ZhLE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/max/2692/1%2Apv-pmMPED1XuTtWlHd6b1g.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let us take a walk down memory lane. When we access our thoughts, we do it in an abstract manner. Through a smell, a color, a location we can access many memories, memories from years ago or as recent as a few seconds ago. Our brain is a beautiful thing, but we cannot always control it the way we would want to. &lt;/p&gt;

&lt;p&gt;Accessing our memories on demand is a complicated thing. With time our memories tend to lose their detail. While recalling memories under stress we tend to forget what we already know by heart. We do not have a specific method of accessing each memory category. For example, let us say we want to remember a recipe. Its difficult to access a section called” recipes”, in part because that does not exist in out brain. We do not have little folders in our brain referencing each material or type of ideas. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eFpxcZoT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.southslope.com/wp-content/uploads/2018/01/bigstock-185247766.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eFpxcZoT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://www.southslope.com/wp-content/uploads/2018/01/bigstock-185247766.jpg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There is a solution, we can save the recipes in a computer, in a nice folder and have other subfolders in it, where we can save different types of recipes. If we have this information on a website, maybe we want to add, create, update, or delete recipes. This is all possible thanks to Thomas Fielding. Mr. Fielding had the wonderful idea called RESTful routing, an idea that dictates a manner to access information via an address that follows a protocol. Example: /recipes/:id/edit. Here we access our recipes, now we need a specific one (:id), then we go an edit it. &lt;/p&gt;

&lt;p&gt;It is all 20/20 hindsight, but early websites did not apply RESTful routing, this made it difficult to locate yourself in a website. But with REST routing, it is easier to navigate and even guess what the next address is, we can maybe type it in ourselves and have access (depending on our security logic). This has brought a type of standardization to the industry, one much needed. &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>webdev</category>
      <category>codequality</category>
    </item>
    <item>
      <title>Get Your Github Repo Verified</title>
      <dc:creator>FigueroaR</dc:creator>
      <pubDate>Sun, 07 Jun 2020 13:58:21 +0000</pubDate>
      <link>https://forem.com/figueroar/get-your-github-repo-verified-1ef9</link>
      <guid>https://forem.com/figueroar/get-your-github-repo-verified-1ef9</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F7384288%2F56078187-aa8ae980-5e17-11e9-89cf-5b1a3d57d25c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F7384288%2F56078187-aa8ae980-5e17-11e9-89cf-5b1a3d57d25c.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is a quick guide to get your repo verified on  &lt;a href="http://gihub.com" rel="noopener noreferrer"&gt;Github&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;First step is to enter Github and create your repo, name it anything you want!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F34520390%2F34878557-8b981b30-f778-11e7-964f-d472699fdec1.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F34520390%2F34878557-8b981b30-f778-11e7-964f-d472699fdec1.jpeg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Second step is to choose a license, without a license, our repo will not get verified. &lt;br&gt;
The one I always pick is the "MIT License". With this option anyone can use or code, but they have no guarantee.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>github</category>
      <category>security</category>
    </item>
    <item>
      <title>Setting up Rails --Api</title>
      <dc:creator>FigueroaR</dc:creator>
      <pubDate>Mon, 01 Jun 2020 01:24:50 +0000</pubDate>
      <link>https://forem.com/figueroar/setting-up-rails-api-4bk7</link>
      <guid>https://forem.com/figueroar/setting-up-rails-api-4bk7</guid>
      <description>&lt;p&gt;A good question is: Why would we want a rails Application Programming Interface? Well… you came to the right place. A short quick and simple explanation. An Api serves to maintain, hold and transfer information. Let’s pretend we are a start up and we have a product called tweeter. Tweeter is an application where we can send tweets (thoughts &amp;amp;/or information) on the internet. Now we need a location (databse) to hold our users who sign up and tweet. Our API talks to our database who stores all out information. This is crucial for any application. For now we are involved in the backend (database) and API – (middle backend) of our application.&lt;/p&gt;

&lt;p&gt;Continuing with our start up example. We need to set up our rails API. First line of code we need to write is&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;rails new tweeter –api&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;we of course called our api “tweeter” but you can give it any name you like&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;rails new any-name –api&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;And that is it, our API is up and running. However, we do not have a database set up. For that we need to create a table and rows of information. It is simple, lets look. So our user here will have a username, email, phone number and a password (we will call it password_digest).&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;rails g scaffold User userName email password_digest phoneNum:integer&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;code&gt;rails g scaffold Tweet content user_id:integer&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;On our column, no need to declare it a string, all info is taken as strings, but phone number which are integers must be declared as integers. Booleans &amp;amp; integers must be declared with their corresponding column.&lt;/p&gt;

&lt;p&gt;Next we run rails db:migrate and we have our first table, model, controller, but for now we wont worry about our views, we will take a look at associations our next talk.&lt;/p&gt;

&lt;p&gt;Do not forget to bundle our gem ‘bcrypt’ it is essential on our Gemfile. Visit our Gemfile and uncomment or add –&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;gem bcrypt&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Then in our terminal run&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;bundle install&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;We are closer now to setting up tweeter.&lt;/p&gt;




&lt;p&gt;At this point we need to scaffold a table, migrate that table, create our associations, console into our project and create users and tweet. Sound Simple enough? Lets dive in then!&lt;/p&gt;

&lt;p&gt;First lets create out “Tweet” table&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;rails g scaffold Tweet content user_id:integer&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;And we get&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class CreateTweets &amp;lt; ActiveRecord::Migration[6.0]

  def change

    create_table :tweets do |t|

      t.string :content

      t.integer :user_id

      t.timestamps

    end

  end

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

&lt;/div&gt;



&lt;p&gt;So now we have a user table and Tweet table and we need to migrate them.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;rails db:migrate&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;At this point our controller and model have been set up.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Tweet &amp;lt; ApplicationRecord
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&amp;amp;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class TweetsController &amp;lt; ApplicationController
  before_action :set_tweet, only: [:show, :update, :destroy]

  # GET /tweets
  def index
    @tweets = Tweet.all

    render json: @tweets
  end

  # GET /tweets/1
  def show
    render json: @tweet
  end

  # POST /tweets
  def create
    @tweet = Tweet.new(tweet_params)

    if @tweet.save
      render json: @tweet, status: :created, location: @tweet
    else
      render json: @tweet.errors, status: :unprocessable_entity
    end
  end

  # PATCH/PUT /tweets/1
  def update
    if @tweet.update(tweet_params)
      render json: @tweet
    else
      render json: @tweet.errors, status: :unprocessable_entity
    end
  end

  # DELETE /tweets/1
  def destroy
    @tweet.destroy
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_tweet
      @tweet = Tweet.find(params[:id])
    end

    # Only allow a trusted parameter "white list" through.
    def tweet_params
      params.require(:tweet).permit(:content, :user_id)
    end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This outcome applies to our User table too. However, our models need an association, how would our table look now? Both User and Tweet&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

  has_many :tweets

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

&lt;/div&gt;



&lt;p&gt;&amp;amp;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Tweet &amp;lt; ApplicationRecord

  belongs_to :user

  has_secure_password

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

&lt;/div&gt;



&lt;p&gt;What happened here? Well we are bringing in extra methods that can be called upon when we need to derive associated information. Our ‘‘has_secure_password” helps to mantain our password hidden when displaying information, it needs ‘gem bcrypt’ to function. I do need some extra users in the database however, so I’ll dig into the console and add them manually.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;rails c&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;then&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;User.create(username: "rocky", phoneNum: 2021234567, email: "rocky@email.com", password_digest: "rocky")&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&amp;amp; a Tweet&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Tweet.create(content: "First tweet!", user_id: 1)&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;The user id column is so important, that is where we put the id of the user who creates the Tweet. Now when we run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Tweet.all
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User.all
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;in our console and we see we have populated information. To see our data display as json data, we simply go to our localhost and use the routes. Run&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;rails s&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 in your terminal and In this case we will go to&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;localhost:3000/users
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&amp;amp;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;localhost:3000/tweets
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;in our browser, (yes it has to be plural or according to your routes if changed). All our information we inserted manually should be there waiting for us.&lt;/p&gt;

&lt;p&gt;That was not so bad! Next, we will utilize active model serializers to display information that is associated with one another&lt;/p&gt;




&lt;p&gt;To setup our Active model serializers we need a few steps. It will be so quick; it will surprise you. Before we start let us look at the data that is presented to us when we initialize our localhost and hit our routes from our backend&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[
   {
      id: 1,
      username: "rocky",
      phoneNum: 2021234567,
      email: "rocky@email.com",
      password_digest: "rocky"
   }
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our password is being shared; we do not want that. So, lets fix it. First, we must access our gem files and add our gem.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gem 'active_models_serializers'&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Then install with&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;bundle install&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Once we have set our gem up, we need to create the serializer objects based on the models we have created.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;rails g serializer User&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;code&gt;rails g serializer Tweet&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Great. Now we have our serializers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class UserSerializer &amp;lt; ActiveModel::Serializer
  attributes  :id
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Oh no, we have only one attribute on our serializers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[
   {
      id: 1
   }
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is where we add or remove our information. Naturally with our routes, our information is being sent through our controllers. But with our serializer we control the data and what is being displayed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; class UserSerializer &amp;lt; ActiveModel::Serializer
  attributes :id,
         :username,
             :phoneNum,
             :email
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Fantastic, we now are sending the specific information we want to share and display Our data now looks like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[
   {
      id: 1,
      username: "rocky",
      phoneNum: 2021234567,
      email: "rocky@email.com",
   }
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A cool trick is to associate data through our serializers, it’s just like creating associations between our models. It looks something like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[
   {
      id: 1,
      username: "rocky",
      phoneNum: 2021234567,
      email: "rocky@email.com",
      tweets: [
         {
            id: 1,
            content: "My first Tweet",
            user_id: 1
         }
      ]
   }
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;How cool is that? We now have finished building Tweeter’s Backend, what an accomplishment!&lt;/p&gt;




&lt;p&gt;One last thing, on your Config/Application.rb file you must have your file like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Application &amp;lt; Rails::Application
    config.middleware.insert_before 0, Rack::Cors do
      allow do
          origins '*'
          resource '*', headers: :any, methods: [:get, :post, :delete, :patch, :options]
      end
    end
    # Initialize configuration defaults for originally generated Rails version.
    config.load_defaults 6.0

    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration can go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded after loading
    # the framework and any gems in your application.

    # Only loads a smaller set of middleware suitable for API only apps.
    # Middleware like session, flash, cookies can be added back manually.
    # Skip views, helpers and assets when generating a new resource.
    config.api_only = true
  end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and add the rack CORS gem.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gem 'rack-cors'&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;along with pry if you so desire&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gem 'pry'&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;then we bundle install.&lt;/p&gt;

&lt;p&gt;Now you are ready to do some Asynchronous calls to your --API&lt;/p&gt;

&lt;p&gt;Thoughts? let me know!&lt;/p&gt;

</description>
      <category>rails</category>
      <category>architecture</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Create &amp; Publish Your First Ruby Gem </title>
      <dc:creator>FigueroaR</dc:creator>
      <pubDate>Fri, 06 Dec 2019 01:50:17 +0000</pubDate>
      <link>https://forem.com/figueroar/create-publish-your-first-ruby-gem-531m</link>
      <guid>https://forem.com/figueroar/create-publish-your-first-ruby-gem-531m</guid>
      <description>&lt;p&gt;We can build and publish our gem in a few steps.&lt;/p&gt;

&lt;p&gt;After we have written our code, our command line interface(CLI) and inspected it, we are ready to upload it (&lt;a href="https://rubygems.org"&gt;https://rubygems.org&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Today we will be updating, creating and publishing a Ruby Gem. We currently are in version 0.1.3.gem.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Kr0xCf6r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/2h8j4kbz9ev5z7nre3zn.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Kr0xCf6r--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/2h8j4kbz9ev5z7nre3zn.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In order to update this gem we need to change the Version, to a higher number preferably. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WV_9_W-N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/l1fkd7z8byoo5xbyx0e5.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WV_9_W-N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/l1fkd7z8byoo5xbyx0e5.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once we have manually change the version number, run this command:&lt;br&gt;&lt;br&gt;
   "gem build insert-name"&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hEyXLhfv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/9rtq2sar30wr3oc7rxa4.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hEyXLhfv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/9rtq2sar30wr3oc7rxa4.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At this point our gem has bee created, I recommend taking the time to visit "rubygems.org" where our gem will be pushed/uploaded to. Create and register an account, you will need it while pushing via command line.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WkcK5kPz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/3pp9ztsc4dx92sit44wn.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WkcK5kPz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/3pp9ztsc4dx92sit44wn.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now it is Live! &lt;br&gt;
&lt;a href="https://rubygems.org/gems/crypto_price"&gt;https://rubygems.org/gems/crypto_price&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tHCFqhKr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/91hp2w3jfyovjlovx9jo.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tHCFqhKr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/91hp2w3jfyovjlovx9jo.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

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