MongoDB Dropped From Rails Composer

I’ve dropped MongoDB as an option from Rails Composer. I’m not sure if this will be temporary, or if it will become permanent. That’s up to you.

MongoDB and the Mongoid ORM were offered in Michael Bleigh’s rails_wizard which I forked in 2011 to develop the rails_apps_composer gem (I use rails_apps_composer to build the Rails Composer application template). Three years ago, MongoDB was popular, especially for quick-and-dirty prototypes or project spikes. Mongoid eliminates the need for migrations because the database automatically adds tables or columns that match models or attributes in a Rails application. That’s convenient, but in the last three years MongoDB lost its halo among developers. Articles such as Sarah Mei’s Why You Should Never Use MongoDB summarize its disadvantages. There are some valid use cases for MongoDB, but most Rails developers now use SQLite for quick-and-dirty prototypes and PostgreSQL for production.

I’ve relied on the community to provide patches to support Mongoid in the rails_apps_composer gem. As MongoDB’s popularity has waned, there have been fewer offers to help. Other databases use ActiveRecord as an ORM and it’s relatively easy to offer support for SQLite, MySQL, and PostgreSQL. MongoDB, not so much, since every model generated by Rails Composer has to be hacked to support Mongoid. That means every release of Rails Composer that makes changes to models requires customization for Mongoid. No one has stepped forward to make the fixes needed for Mongoid support, so GitHub issues are open and not getting resolved.

Rails Composer is primarily a tool to build the RailsApps example applications. I actively contribute code and resolve issues to support that mission. Rails Composer has a “build your own option” and a large community of developers contributes code that supports popular gems and favorite configurations. I merge pull requests that support options I don’t actively use. When I accept a pull request, I trust and hope that the community of developers will actively maintain any options that I don’t use, but sometimes a gem will lose popularity and end up as a neglected and little-used option in Rails Composer. If no one notices, that’s fine, it is just cruft in the code.

The Mongoid option creates more of a problem, though. A few people still choose the Mongoid option in Rails Composer, and people have opened GitHub issues to report problems with Mongoid. That’s fine, but the issues are languishing and no one has submitted patches for a fix. Consequently, I’ve decided to drop the Mongoid option from the Rails Composer menu.

If you want the Mongoid option in Rails Composer, let me know and I will work with you to prepare the code that’s needed to support Mongoid. If no one steps forward, I’ll assume Mongoid is really no longer wanted.

Learn Ruby on Rails for Rails 4.1

Today I’ve released version 2.0.1 of the book Learn Ruby on Rails. Last week I released version 2.0.0 with major updates.

You can get the updated book when you join the RailsApps project:

This is the only Rails book that covers Rails 4.1. Does that matter? I think so. If you’re a beginner, and you install the newest version of Rails, and your book doesn’t match what you see when you open Rails, you’re going to feel lost from step zero.

Plus, Rails changes every six months in significant ways. Rails 4.1 introduces the config/secrets.yml file which offers a new, recommended way of setting configuration variables, a facility at the core of any Rails application. Rails 4.0 introduced strong parameters, a new way to handle forms submissions that affects almost every Rails application.

It is challenging to always update books, videos, or online courses for the newest version of Rails. It seems most authors and publishers don’t bother, or wait months to release a new edition. I’m trying to change that, by publishing Learn Ruby on Rails as part of the RailsApps project, with a subscription-based business model.

How am I doing? Rails 4.1.0 final was released April 8th. I released an updated version of Learn Ruby on Rails the same day.

Here are details about what’s new in each version. The book has a “Version Notes” chapter with more details.

Version 2.0.1

  • Added resources to the “Get Help When You Need It” chapter
  • Added a section explaining the config.assets.precompile configuration setting
  • Added a hint about passwords that use punctuation marks (contributed by a reader)

Version 2.0.0

  • Updated references to Ruby from version 2.1.0 to 2.1.1
  • Updated the tutorial application from Rails 4.0 to Rails 4.1
  • Dropped the Figaro gem and showed how to use config/secrets.yml
  • Updated the “Front-End Framework” chapter
  • Updated “The Parking Structure” chapter about the Rails directory structure
  • Introduced the concept of service-oriented architecture (SOA)


You can read the book online or download it in three ebook formats: PDF, Mobi (Kindle), ePUB (iBooks). A subscription is $19/month, which means updates, plus additional books and tutorials. Right now, when you purchase a subscription, you get:

You can sign up for a subscription on the RailsApps site. In addition to getting books and tutorials, you’ll be supporting development of the RailsApps example applications and tools for starter apps.

Nitrous.IO Hack Button

I’m fascinated with Nitrous.IO. If you don’t know it, it’s a service that gives you a computer inside your web browser. It’s free for small projects and you get a powerful Linux-based development environment that’s hosted “in the cloud” and available instantly in any web browser. It’s no big deal if you’ve already got a full-blown Rails development environment installed on your local machine. But for thousands of newcomers who are daunted by the obstacles of installing Rails, Nitrous.IO delivers a development environment without hassle. In my Learn Ruby on Rails book, I recommend it to anyone who encounters difficulty setting up a development environment for Rails (and that means almost everyone on Windows).

Now there’s the Nitrous.IO Hack Button. Here’s what it looks like:

Hack RailsApps/learn-rails on Nitrous.IO

Click on the button and you can log in to Nitrous.IO with a RailsApps example application fully installed and ready to run. No need to install Ruby or clone the repo from GitHub. The Nitrous.IO Hack Button does that for you.

I’ve added the Nitrous.IO Hack Button to six of the RailsApps example applications:

So anyone can try the example applications without installing a development environment locally or cloning the Github repo.

For most RailsApps users, who are experienced Rails developers with their own local development environments, or for students who need to set up a development environment so they can begin to master Rails, the Nitrous.IO Hack Button won’t be useful. Nonetheless I’m fascinated by the idea that one click can create an entire Rails development environment with a ready-to-launch Rails starter app.

5 Starter Apps for Rails 4.1 from Rails Composer

You can use Rails Composer, “the Rails generator on steroids,” to create any of the Rails 4.1 example applications from the RailsApps project. In minutes you get a starter app, ready to customize and deploy.

Here’s the newest starter app you get with Rails Composer:

Devise is for authentication and user management. You might not know Pundit. It’s a great new gem for authorization and access control, simpler than CanCan and easier to use with Rails 4.1. Together with options for Bootstrap or Foundation, you get a powerful starter app in minutes with Rails Composer.

Make sure you have Rails 4.1.0 installed and run:

$ rails new myapp -m

You’ll get a menu of starter apps. Choose options for ERB or Haml or Slim, different databases, and Bootstrap or Foundation front-end frameworks.

Here’s the complete list of starter apps that Rails Composer will generate for Rails 4.1:

Development of the Rails Composer tool is supported by the RailsApps project. If you like the tool, please accept our invitation to join the project as a subscriber.

Quickstart Guides

I’ve launched Quickstart Guides, a new format for RailsApps publications.

These Quickstart Guides are available only for RailsApps subscribers. If you haven’t yet, please join the RailsApps project so I can continue to release example applications and new guides and tutorials.

Today two new guides are available:

Everyone loves the in-depth RailsApps tutorials but I’ve wanted to create a series of shorter guides that help experienced developers get started quickly. These new guides are an experiment; please let me know if you like the new format and I’ll continue with more topics, including guides based on the new example applications for Devise, OmniAuth, and Devise and Pundit.

Example Apps for Rails 4.1

Rails 4.1.0.rc1 is out and I’ve released new example applications for Rails 4.1:

I’ve also updated earlier example applications for Rails 4.1:

With Rails 4.1, I’ve dropped the Figaro gem and am using the new app/config/secrets.yml file to manage configuration variables such as login credentials or API keys.

Rails Layout Gem With Navigation for OmniAuth

I’ve released a new version of the rails_layout gem that sets up appropriate navigation links for OmniAuth (sign in and sign out). OmniAuth is a popular gem for authentication.

The rails_layout gem already generates navigation links for Devise. But I wanted to support OmniAuth as an alternative to Devise for authentication.

The goal is to improve support for OmniAuth in the Rails Composer tool. I’m releasing that today, too.

Learn Ruby on Rails

I’ve released version 1.19 of the book Learn Ruby on Rails.

Version 1.19

The new version shows how to set up the Foundation 5.0.3 front-end framework. Foundation 5 has been out since November but versions 5.0.1 and 5.0.2 were incompatible with the Rails asset pipeline and Turbolinks. Foundation 5.0.3 is compatible, so I show how to use it in the book.

I’ve rewritten several chapters based on suggestions from technical editors. The revisions improve clarity; the tutorial application is the same.

Forthcoming Changes

Rails 4.1.0.beta1 was released December 18, 2013. I expect the next version of the book will cover Rails 4.1. The Figaro gem will be dropped, along with the config/application.yml file, which will be replaced with a config/secrets.yml file.


Right now, the book is available only to people who have purchased subscriptions to the RailsApps project. You can read it online or download the book in three ebook formats: PDF, Mobi (Kindle), ePUB (iBooks). A subscription is $19/month and gives you access to updates, including the forthcoming update for Rails 4.1.

You can order the book on the website for Learn Ruby on Rails.

People who contributed to the Kickstarter campaign for the book can also download the newest version of the book.

Rails Layout Gem v1.0.1

Today I released the rails_layout gem version 1.0.1. The gem is getting frequent use and I’m getting significant and useful code contributions.

I built the gem so I could easily generate application layout files for a choice of front-end frameworks, including Foundation and Bootstrap. The gem is a key component to the Rails Composer tool, which generates starter apps. You get a choice of front-end frameworks to bake into your starter apps.

I’m working on a new example application for Rails and Devise. The Rails 3.2 example applications that use Devise have been popular starter apps. The new rails-devise example application is even better. Of course it is updated for Rails 4.0, but it also offers a choice of Foundation or Bootstrap, for a more attractive starter app.

Devise can generate view files for login and signup pages (also “edit account” and “forgot password” pages) but the pages are not attractive. The new starter app uses the rails_layout gem to generate attractive view files for Devise that contain CSS styling for Foundation or Bootstrap. Here’s a screenshot of a login page, using Foundation.

The idea of a starter app is to save time for developers. Everyone needs a basic application that uses Devise, with a favorite front-end framework. Why build it from scratch? And why tweak the Devise view files every time? Let’s go open source with a starter app.

In releasing version 1.0.1 of the rails_layout gem, I’ve changed its API and its commands to accommodate the new feature that generates Devise views.

The rails-devise example application is still a work in progress but you can try it out. Just build it with the Rails Composer tool.

You can also use the rails_layout gem on its own.

As always, a big shout of thanks to the developers who support the RailsApps project with monthly subscriptions.

CrowdOutfit Powered Up by the RailsApps Project

I love to talk to entrepreneurs who’ve launched their ideas using applications or tools from RailsApps. I recently heard from Chris Armstrong, founder of CrowdOutfit. Here’s an interview about his experience building the CrowdOutfit site.

What is CrowdOutfit?

CrowdOutfit is a community of fashionistas that track down clothes you see online and love, but can’t find where to buy in your price range. Post a pic and we track it down or re-create the look for less.

Many people admire favorite styles from Pinterest pins and blog posts. But way too often, when they want to buy the clothes they get the dreaded ‘out of stock’ page, or worse yet, no trace of where it came from! Even if they can find the item (after hours of searching) a lot of it is way out of the price range of your average person. Looks pretty, but no thanks to that $2,500 jacket…

Our community solves this problem. We track down what you want in your price range. You show us what you want (or follow someone else’s request) and a community of personal shoppers find it for you.

Are you a solo developer?

The team is me, myself and I. I’ve been the designer, full-stack developer and now full-stack marketer of the project. This has been great from a learning experience and full-control perspective, but obviously makes time my biggest enemy.

What’s your skill level in Rails?

My skill level is Intermediate. I have a background in information systems from an analyst/project management side and have done some coding in the past. However, I was new to Ruby and Rails when I came upon RailsApps.

How was the RailsApps project helpful?

Too many tutorials focus on using Rails scaffolding to create a basic app. Intro tutorials can show off the power of Rails, but don’t help with a realistic production-ready app. RailsApps gave something much better, a starting point project that included the basics anyone would need, including powerful gems that don’t re-invent the wheel. This allowed me to look through and see how things were set up. RailsApps modeled good practices in the way it set up layouts, development/testing/production configuration, and overall good config and YAML files (e.g. keeping environment variables private for your SMTP or API key credentials).

I was quickly able to customize what I wanted. Whenever I wanted to add a feature, there was a good working reference of where to plug in things. Then, as my knowledge grew it was easier to make more sweeping changes.

Which example app did you use?

I used the Twitter Bootstrap, Devise, CanCan example app. It’s a great starting point for any site with user accounts and lets you tap into the power of Bootstrap for design. Most web apps depend on the basics provided in this app.

What modifications did you make to the app?

The benefit to a starter app is it can be used by nearly any site and then you can add what you need. I made numerous modifications (mostly enhancements) that ended up being specific to the visual-Q/A community-driven site I was building.

Some of the modifications I made include:

  • Integrated Omniauth with Devise to support Facebook logins instead of just e-mail
  • Customized Devise to allow users to login with either their username or e-mail address
  • Made use of slugs for more descriptive URLs for outfit requests and finds
  • Added multiple mailers for transactional e-mail (a RailsApps article helped with my decision to go with Mandrill)
  • Integrated Nokogiri for image scraping to create outfit requests
  • Customized design (extensively customized Bootstrap for less generic look and numerous UI components)
  • Added JavaScript interactions to make the user experience more seamless
  • RailsAdmin

Before I integrated analytics at a deeper level, I was using RailsAdmin for a glance at who the newest users were and whether they returned to the app (super important to monitor for engagement).

What’s the biggest challenge you’re facing now?

The biggest challenge is on the marketing side. I was in complete coding and dev mode before. Now, with an app out in the wild, the key is bringing in traffic and getting people engaged with the product and using it on a regular basis.

The most important thing is to focus on measuring what people are doing in the app, what makes them come back, and what’s a roadblock keeping them from being more engaged. Users need to get value out of their experience (and quickly). The more I can focus on good lifecycle e-mail marketing, a better initial walk-through experience, reducing user friction to use the community features, making it easy to share the site, etc… the more the community will grow.

Programmers often over-focus on optimizing code, but marketing while you code is crucial to actually get people using what you’ve created…no matter how awesome it is!

I just want to say I’ve really appreciated your fantastic work on the RailsApps project. It’s a great marriage of clearly articulated writing/documentation and real, usable code (a rare combo).

Next page Something went wrong, try loading again? Loading more posts