Ruby on Rails (Page 2)

Disable Rake Commands in a Rails Project

Sometimes you want to disable some of the default rake tasks in a rails project. Here's a quick way to do just that.

May 15, 2015

Bi-Directional has_and_belongs_to_many on a Single Model in Rails

Bi-directional HABTM relationships are easy in Rails, but when you need to do it on a single model, that's when it gets tricky. Here's one approach.

May 04, 2015

How to Write a Custom Rake Task

Rake provides a great way to automate repetitive or complex tasks. Here's a look at creating a simple and a more complex task.

Apr 27, 2015

A has_many Relationship within a Single Model in Rails

Here are a couple methods for dealing with uni-directional many-to-many associations in Rails.

Apr 04, 2015

Why I Don't Use has_and_belongs_to_many in Rails

The magic of Rails makes it easy to create simple many-to-many relationships, but I almost never use it, and here's why.

Mar 31, 2015

Connect to a Remote MySQL Database in Rails

Using a remote database with rails is useful for collaborating on projects or for keeping all your data in one place. Here's how to get it set up from scratch.

Mar 09, 2015

Connect to Multiple Databases in a Rake Task with Rails

Sometimes you need access to multiple database within a single rake task, for whatever reason. Here's how you do it.

Feb 17, 2015

Convert PDF to Image with Dragonfly and Rails

Converting a PDF to an image using Rails and Dragonfly is actually quite simple. Check it out.

Jan 06, 2015

How to Transition from CarrierWave to Dragonfly

It can be a process to move away from CarrierWave once you're already using it. Here's a step-by-step process to make it easy to transition to Dragonfly.

Jan 02, 2015

Instantiate a Class from a String in Rails

Rails classes need to be called dynamically sometimes. Learn how to do it using the constantize inflector.

Nov 20, 2014