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.
rails -h
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…
Intro
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. …
Following on from part 3 we are now going to add the functionality to edit and delete the articles in our app, Within the article controller file I have added the following code continuing with the principles of CRUD (create, read, update, destroy). Being we are now added functionality to edit articles we are are in the update portion of CRUD.
As you probably guessed by now we again need to add a new view, this time for the edit page, remember we need to create this with a corresponding name ‘edit’. …
Wow It's crazy to know I only have two weeks left at Makers Academy and I will then be onto the job search. The next two weeks are going to be the craziest yet as we will all be working on our final projects. I have been thinking a lot about this, however, I have also been thinking a lot about my personal work too, I have a lot to do!
Everything I have learnt over the past couple of months is going to really be put to the test. I am excited and anxious at the same time, the…
I’m sure every developer at one point in their career looks back at a GitHub repo in despair, I know for sure I have. Messy commit messages, poorly named variables, and clutter that should have been refactored out long, long ago. In this article, I’m going to cover a number of pointers that will help keep your code looking appealing to employers and your fellow dev’s happy. I will be focusing more so on presentation and workflow apposed to tech specifics, however, I may touch on a few things here and there.
As developers are well aware GitHub will be…
Ok after completing part 2 we can now see each article rendered as it was added, however, we now need a way to see a list of articles. The first thing I have done is added a new method to the index articles controller, this method retrieves all of our articles using Article.all.
As we did before; we now create the HTML for index and use the values from @articles to list them.
Hi, I’m Steven, most call me Steve! I’m a programmer, musician, and artist. This blog contains various tutorials and posts related to software development.