Using gems instead of rails plugins on heroku

less than 1 minute read

Heroku is great, you can have a rails app running live in a few minutes ! There are still a few tricky points you’ve got to sort out a little differently. One of them is using rails plugins or extensions. The usage way is to have a submodule in your git repository, but heroku does not support submodules … You are left with 2 choices :

  • Expand the submodule as classical files in your main git repository
  • Use the extension or plugin as a gem (if possible)

When I can, I’ll go the second route. Last time, I ran into a problem. I wanted to use radiant-tags-extension gem with my radiant app, but I could not launch the install rake task

rake radiant:extensions:tags:install

I eventually found out that rake tasks from gems are not automatically available from the mail rake command. I also found this and it did the trick.

# <railsapproot>/lib/tasks/gems.rake

Dir["#Gem.searcher.find('radiant-tags-extension').full_gem_path}/lib/tasks/*.rake"].each { |ext| load ext }

I usually write about 15 minutes worth of reading per month. I won't transfer your email. No Spam, unsubscribe whenever you want.

As a gift for subscribing, you'll receive an illustrated mini-ebook "How to start a team coding dojo"!

Leave a comment