A Blog With Rails

Introduction:

Warning this only works on Mac OS.

Now before you start thinking your going to make the next WordPress, let me just say we are only going to be making the MVP of a blogging site, that’s right a MVP. What is a MVP you may ask ? It stands for Minimum Viable Product, this thing we are about to build is just a web app that has CRUD functionality. What is CRUD you ask ? CRUD is Create Read Update Destroy.

Don’t be afraid of the terminal, the terminal is your friend for life ๐Ÿ™‚ you just got to treat it right.

Up and running:

  1. Install Home Brew, is manages the software you need to manage all the software, your going to use to make software. Just follow the instructions on here:ย https://brew.sh/
  2. Install Bundler, it manages the specific Ruby software libraries for your application. Type the following command “gem install bundler”.
  3. Install Nokogiri, it gives Ruby the ability to understand HTML and CSS among other things. Type the following command “gem install nokogiri”. This is going to take awhile, chill out and take a break you have been working too hard ๐Ÿ™‚
  4. Install Rails, its the thing that you build on top of, to make your web application. Ruby the language has libraries for doing different things. Rails is just a really big library for making web based applications.ย  As you may have guess just type in “gem install rails”.

 

Making a Rails App:

  1. CD into a folder you would like to be in and run the following command “rails new <name of your app here> -T “
  2. Now if you look into the folder you just ran this command in, you will see a folder with the name of your app. Open this with your favorite text editor, VSCode is always a good choice.
  3. CD into the newly created folder, and make your database. You can do this by running “rails db:create” and then running “rails db:migrate”. What this is doing is creating a database, and then populating it with boiler plate info.
  4. Now run “rails s” and go to the URL is gives you. You should see your app, YAY you made your first rails app ๐Ÿ™‚ If the URL isn’t working try using http:127.0.0.1/8080 orย http:127.0.0.1/3000.

 

Actually making the Blog:

  1. Run “rails g scaffold Blog title:string body:text”. What this command will do is create a Blog object, that has a title and a body and can be stored in our database. Rails knows this since “g” is for generate, “scaffold” is for create everything for me, and the rest is specify what type of things you want there to be, in the object you are creating.
  2. Now you got to let the database know about this blog object you made. To do so simply run “rails db:migrate”
  3. Finally the moment you have been waiting for, run your app with “rails s” and ta-da you go your self a working rails app ๐Ÿ™‚

“?” in Angular 5

As you an Angular component has a life cycle, much life us humans. In the beginning we are nothing, we do a bunch in the middle and then we die ๐Ÿ™‚ However if you want to call a certain service in yourย “ngOnInit” to dump some values into a var that appears in your html, your going to have a bad time. Or at least angular is by throwing a lot of errors in your console, I mean it will still work.

To get rid of these errors all you have to do it the following add a “?” at the end of the end of the var that’s in the html, and ta-da errors gone. This works since the “?” tells Angular to chill out there will be a value you there “eventually”. Hmm… but why eventually you may ask ? Its because two functions before “ngOnInit” get called , the very first one being the constructor of the class and the second being the “ngOnChanges” method. So for the execution of the first two methods its asking “WTF where is this thing in the html in the .ts file ?”ย  which makes throw errors.

Project – The Knight

After taking a long hiatus from Unreal 4, cause I didn’t like blue prints (Unreal 4’s Visual Scripting Language) I preferred real programming (C++) . At which point there started to be a nice long 3 second compile time ๐Ÿ˜ฆ

I switched to Blue Prints ! I bought my self a course and started going at it every day after work ( well … almost every day … West World doesn’t watch it’s self )ย  I made the final project in the course, plus some of my own additions (these additions mainly making the game look AAA, and adding UI) .

So this post is dedicated to saying “Hey look I made this cool thing ๐Ÿ™‚ ! ” mostly by my self.

Its you basic point and click ARPG that only has one level, and uses alot of the Infinity Blade assets that Epic has given away for free. Here are some screen shots:

 

UPDATE: 2018-08-18:

I plan on adding a better AI to the game using Unreal’s Behavior Tree

Status Update

Its been ages since I posted here, mainly cause I got super sick and mainly cause I don’t feel the need to anymore.

Now I have been working on a few things since the last time you saw me. A lot of different things, Like Unreal 4 games, .NET Core apps, Ruby On Rails Apps, and Angular Apps. Some of which you will be seeing posts about.

For the most part my efforts to learn new things goes awry because I get side tracked by a shiny new thing. However for this coming month I am going to try to focus on a few main things:

  • .NET Core + Angular – Cause I like how light weight and fast it is ( Got to get in touch with the future of my beloved C# โค )
  • Unreal Engine 4 – Cause I like easy to use pretty things. Unreal is easier (Blue prints) to do something fast ( I don’t want to write that much code) Plus it already has a awesome AI system built in.
  • Ruby On Rails – Cause it seems like the web developers ultimate tool bag (this is mainly due to watching a number of talks by DHH)