One of the main reasons why Rails gained traction quickly is due to the default stack. New developers don’t have to make major decisions about what to include in their application’s infrastructure. That makes it easy to ship useful applications quickly.
However, as you gain experience with the framework and become more knowledgeable about what makes web applications stand the test of time, you find yourself making substitutions and additions.
For instance, Rails comes with MiniTest for testing, but you substitute that for RSpec because you can recite all the RSpec matchers in your sleep and everyone on your team already uses RSpec.
Which means you don’t have to worry about someone breaking stuff because they don’t understand what your tests are doing. And the fact that you can compliment RSpec with shoulda-matchers makes it a no brainer to stick to what you already know.
After shipping a few applications, you realize that you always include the same gems as part of your set up process, even before you start working on the core functionality.
Eventually you become frustrated with your setup process because you keep doing the same thing over and over. Although you prefer your application a certain way, you can’t stand spending an entire day making things just right before you get to the fun part.
In the name of productivity, you start looking for a better way to bootstrap new apps.
You can set up your Rails app the same way every time using a template that meets only your preferences. Or you can learn to use another Rails starter app that’s not an exact match for your preferences, but good enough to get the job done with minor tweaks.
I prefer to use Suspenders Rails starter app to bootstrap new Rails applications instead of creating my own template mainly because it’s maintained by a team that’s well respected.
You don’t need any convincing that using Suspenders is better than creating and maintaining your own template once you take a look at Suspenders’ Gemfile.
Before I started using Suspenders, it never occurred to me that I needed a staging environment. I’d just deploy the app into production after completing a major feature, only to find that something that worked locally doesn’t work in production.
Since I started using a staging environment, I always get a chance to fix things before the end users are exposed to the application.
Additionally, Suspenders comes with Dotenv for loading environment variables, which prevents you from accidentally exposing credentials for external services.
You also get web console for better debugging via an in-browser IRB console; all of which are already configured and ready to go when you generate a new Rails app.
I’d bet none of the tutorials you completed while learning Rails mentioned the importance of integrating analytics tools into every Rails apps you work on. I didn’t think about that until I saw Segment listed as one of the goodies included in Suspenders.
Of course Suspenders has more to it than the things I’ve mentioned above, but I wanted to highlight those because they are the things I initially overlooked.
Getting Started with Suspenders Gem
You can run
gem install suspenders to install the gem or
gem update suspenders to grab the latest version if you have an older one.
I already have an older version installed, so I’ll update and then delete the previous one.
Now choose a name for your project, then run
suspenders projectname. That will create a Rails app in
You’ll most likely have a problem with connecting to PostgresSQL during the creation of your Rails app; make sure you have PostgresSQL installed and running.
Even then, you still need to provide a username and password for connecting to Postgres, otherwise
db:create won’t work.
We can use Dotenv to supply those credentials, along with a secret token.
.env.development and add your configuration.
1 2 3 4 #.env.development SECRET_KEY_BASE="keep_this_a_secret" DB_USERNAME="keep_this_a_secret" DB_PASSWORD="keep_this_a_secret"
database.yml with your password and username as such:
Now, create your developement and test databases, run a migration for
delayed_job and restart your server. You should see the Rails welcome page on port 5000 after that.
Choosing Your Profitable Customer Creation Formula
There’s no better way to learn a new programming language, framework or skill than to apply what you’ve studied to practical projects. However, it can be difficult to find commercial projects you can work on to improve your Ruby on Rails skills.
It’s likely you’ve postponed building something tangible that you can show off to your friends and potential employers because everything becomes a slog after you’ve learned the basics of Ruby and Rails.
Instead, you end up reading every tutorial about the latest Ruby gems and SQL optimization techniques, making things even more complex.
If you’ve taken Ruby on Rails courses, read dozens of books, and still feel like you need to memorize the core Ruby classes before you can call yourself a Rails developer, you’ll be pleased to know that there are just five ways to use your new found skills and knowledge.
When you’re hired as a Rails developer to create value for both offline and online businesses, there are five possible ways to achieve that.
Let’s discuss the five practical Rails projects you’ll ever be tasked to build, the Rails starter app you could use, plus must-have features and Ruby gems that’ll speed up your development process.
You can use a Rails starter app to build brochure sites
Businesses have used brochures to present themselves in various situations to prospective buyers since printers were invented.
Salespeople leave them behind after a visit with a prospective buyer, send them through the mail or stuck them under windshield wipers to show their products and services.
The most important thing that a brochure accomplishes is convince people to contact the company about their offerings. While paper brochures are limited to six panels, you can use Rails to build brochure sites with pages of information for prospective buyers.
Brochure sites aren’t good at generating leads and sales for businesses, but they do a fantastic job of supporting salespeople, who can refer prospects to it to learn more about products and services.
You’ll also build brochure sites to provide contact information about a company, help visitors find the location of physical stores, and establish a company’s brand image.
You can use a Rails template to build publication sites
A typical publication site offers original and curated information for prospects and customers to consume. Examples of publication sites include Medium and Code School.
If you’ve ever built a blog with Rails, you’re already familiar with publication sites.
They provide content in a variety of formats and media, such as text, video and audio. The goods for sale on publication sites are either original or curated online content, and they make money through subscriptions, donations, and advertisements.
You can use a Rails boilerplate to build online stores (ecommerce)
Amazon, Etsy, eBay, information marketers and book authors use online stores to sell one or more products. Online stores (or Ecommerce sites) allow visitors to purchase a product, using any agreed-upon currency.
Online stores are different from publication sites and SaaS apps in that they don’t provide the product or service directly. Instead, you’d either download a digital product from an online store or get a physical product shipped to you after your purchase.
You can use a Rails composer to build consultative sites
Consultative sites are built to support salespeople through long business-to-business sales cycles. They help prospective buyers educate themselves about the problems they have and the solutions available to them until they are ready to make a buying decision.
You’ll build a consultative site for a company that delivers complex or expensive products and services. When multiple people are involved in the decision to purchase a product or service, you’ll need a consultative site.
Your primary goal when building a consultative site is to provide guidance because it may take several days, weeks or months to sell complex offers.
You can use a Rails application template to build online services
Applications like Pivotal Tracker, GitHub, and Basecamp were once delivered through desktop software only, but they’ve been replaced by online services you can access in your favorite browser.
Today, you can manage your finances, socialize with friends and family, organize your project ideas, and communicate with your teammates from the comfort of your browser.
Rails is a perfect framework for building these kinds of online services (or SaaS apps) in almost every industry. An online service could be used by just a company’s employees or could be productized and made available to other businesses to purchase.
In either case, you’re delivering a product with the online service and customers must be granted access before they can use the product.
What Is The Right Formula For You?
If you’re familiar with Brian Massey’s book, Your Customer Creation Equation, will recognize the practical Rails projects discussed here as customer creation formulas.
When building a Rails application for your client or for your own business, you’ll choose the right combination of formulas to produce measurable results.
The right combination will depend on how the business makes money.
That means for one client, you might build an online store and a publication site, and for another, you might build a SaaS app and a brochure site. Regardless of how you use Rails, you must implement specific features to turn your coffee and code into an asset.
Must-Have SaaS Features and Useful Ruby Libraries
There are several Rails gems that will make you an extremely productive Rails developer and help you produce high quality code.
These 11 Rails libraries and other alternatives are useful for every occasion.
In order to help stakeholders make better business decisions and get a good ROI from the software you build, you must implement analytics, onboarding, and marketing automation as well.
For analytics, Segment gives you the ability to aggregate data from several analytics providers, including Mixpanel and Google Analytics.
You can create an analytics facade to pass data to Segment and track every user interaction in your Rails app.
You can’t just deliver a product and expect users to know how to use it on their first encounter. To improve engagement, user adoption and retention rates, you need personalized onboarding flows.
You can provide a better onboarding experience in your Rails app with UserPilot
If your Rails app is for internal use only, you don’t have to worry about marketing automation at all; however, if you’re working on consumer-facing product, you should implement marketing automation…
The three primary ways to implement marketing automation and help your business reach more potential customers is through social sharing, email marketing and referrals.
Integrating social sharing is easy; use shareable or any other social sharing Rails gem.
There are several options for transactional emails in Rails, but I’d recommend you take a good look at those that allow you to automatically send messages based on user behavior.
Getting your current customers to refer others to you is a great way to grow your online business. It’s easy to implement referral marketing with Ambassador, but that’s pricy.
Now that you’ve setup your Rails starter app, your ideal next step is to build your client-centric portfolio and unlock your Ruby and Rails 5 genius.
You’ll showcase this on your GitHub profile and also send them to potential employers and/or clients to close deals on the spot. You could also monetize your client-centric portfolio and start generating additional income right away.