This week in my Rails development journey I have been upgrading an outdated application to Rails 6. This process involved a number of tasks such as updating the app from sprockets to webpack, updating a few deprecated methods, and last of all replacing active scaffold.
For those of you who don't know active scaffold is in a sense a predecessor of Rails Administrate, like Administrate active scaffold allows you to perform typical CRUD actions on a database through a nifty user-friendly UI. Seems pretty straight forward right? Add the gem, run the install, remove the old stuff, and good to…
What is Sphinx? Well, in a nutshell, Sphinx is a Python documentation generator, but in reality, it is so much more. Sphinx has the rather impressive capability of converting reStructuredText and Markdown documents into HTML files, PDF’s and much more.
This means with Sphinx, you have the capability to create entire static sites out of Markdown documents, which is pretty nifty! Sphinx gives you the capability to create custom themes whilst also providing an abundance of prebuilt options and configurations.
This blog is a continuation of Rails Routes P.1 Understanding Route Structure
A common task when building Rails applications is creating custom routing, so let's look at a few ways we can restructure the anatomy of our routes.rb file.
Let's start with the common task of routing static pages, say we generate two pages with;
rails g controller Pages about contact
This command will create a directory appropriately named Pages with two pages named ‘about’ and ‘contact’. However, what will the routes look like, well initially this..
As these pages live in the Pages directory Rails helpfully tries to rout…
One of the most confusing things I found whilst learning Rails was how to correctly use routes. It is my hope through this blog I can uncover some of the magic our routes.rb facilitates.
To list the existing routes in your project simply run
When running this command your terminal will provide output similar to the screenshot below. You can refine your search to specific model names using a pipe, for example..
rails routes | grep blog
This will refine our search to only show routes linked with the blog model, this is particularly useful when working with…
The purpose of creating a seed file in short is to populate sample data in your rails database. Having prepopulated data helps us test our application and better understand how it will look in production.
When creating a Rails application a seed file is created within the db directory and it’s named seeds.rb. By default, this file will have no code in it however Rails helpfully provides some clarification of its purpose.
# This file should contain all the record creation needed to seed the database with its default values.# The data can then be loaded with the bin/rails…
This blog is a continuation of Rails Generators - Controllers
As convenient as generators in Rails are it’s very easy to get carried away cluttering your app with unnecessary code. Thankfully Rails offers us multiple ways to avoid this issue by giving us the option to leave out unneeded files and functionality.
Configurations handled in the application.rb file.
One way of doing this is providing your generation commands with flags, for example -T is the flag for excluding test files. However, this soon gets tiresome as your app grows in size, but fear not! We can configure rails generators to…
I have recently been getting back into some Rails development so I’ve decided to make a short series of reference blogs on common generators.
Note: you can list Rails generators with the following command.
To the right, you will have a basic explanation of what each flag does, however, it is my hope through this blog I can provide a little more context on independent use cases.
One important thing to note about this helper’s flags is you have the ability to selectively exclude items. For example, looking at the screenshot below we could independently exclude TurboLinks with…
Considering attending Makers? Well, you're in the right place! Hopefully, my review can help give you some valuable insight and help you make a decision with confidence.
Last year I took a huge risk and left the stability of my job to pursue a career in software development. It was a really tough ride going at it alone so I reached out to a fellow developer for advice, it was not long into the conversation he recommended Makers. He’s a senior technical consultant and stated; “You should try Makers, some of the best developers I’ve known came from there”…
This week I have been exploring the world of WordPress development and I felt it would be a great opportunity to get back into some blogging. In this blog, I will document everything you need in order to get up and running with a WordPress dev-environment.
What is WordPress?
WordPress is an open-source content management system (CMS), it is written in PHP, MySQL, and/or MariaDB. WordPress is typically used for blogging, e-commerce, business, and portfolio websites. It allows users to easily manage the content of their website independently without needing a background in tech. …
So for those of you who don't know, I have recently graduated from Makers Academy! However, coming out of the course and falling into the current job market has not been a fun ride. I won't deny it, I have experienced my fair share of stress and worry! It’s a tough time for me, my fellow junior devs, and many others around the world. It has become harder than ever to break into most industries.
I write this blog not to indulge in pessimism but to remind everyone your not alone in this struggle and you WILL persevere. …