Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 543549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:33:46+00:00 2026-05-13T10:33:46+00:00

As a Rails developer I feel a bit stupid asking this question but hopefully

  • 0

As a Rails developer I feel a bit stupid asking this question but hopefully I will learn something new and someone can put me out of my misery! In my rails applications I use (other peoples) gems all the time, I also use plugins from the community or my own.

I understand the benefits of use gems over plugins as they are version-able, segmented, system wide, easier to manage and share etc etc but I don’t really know how to go about making a gem for my rails apps!?

Do you always start with a plugin and convert it to a gem, I’ve seen the words ‘package it as Gem’. Also the gem I’m thinking of building would be no good in a normal ruby program, it’s only useful to rails apps. I’m not even sure if the semantics of that make sense, ‘RubyGem’ that will only work in a rails application!?

I would like to create a gem (if that’s what I should use?) for a discrete piece of functionality for my rails apps. It will need to add a database migration, new routes and provide controllers and views or useful view helpers. I’m know I can achieve this via a plug-in but would just like to know how/why to do it as a ‘Ruby Gem’?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T10:33:46+00:00Added an answer on May 13, 2026 at 10:33 am

    To avoid the risk of Over-engineering, I usually start with the feature I need directly into the application. Then, as soon as I need to use the same feature into another project, I check whether it is worth to extract it into a plugin or even a separate application providing an API.

    Plugins and Gems are often interchangeable. Gems provides several significant advantages in terms of reusability and maintainability.
    On the other side, there are some specific known issue. For instance, a Rails app actually can’t load rake tasks defined into a plugin packaged as a Gem.

    Almost every Rails plugin can be packaged as a Gem.
    For instance, take my tabs_on_rails plugin.

    You can install it as a Gem specifying the dependency on environment.rb. Or you can use script/plugin install command as you would expect.

    If you want to achieve the same result, make sure to follow the standard Gem layout and provide the init.rb initialization script required by Rails.
    Also, you might want to create an install.rb and uninstall.rb file to include the post-install and post-uninstall hooks when the plugin is installed as a standard Rails plugin.

    Last but not least, if you package a plugin as Gem you can reuse it in non-Rails projects and provide Rails-specific initializations using the init.rb file. Non-Rails applications will simply ignore it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm mostly a Rails developer but sometimes, I have to code in PHP. Because
I am a ASP.NET Developer trying to learn Rails and RESTful approach. To understand,
I am a somewhat experienced Rails developer and I thought I would try out
Rails comes with RESTful resources out of the box, but do you use those
Rails is a great platform, but it just doesn't have the history that Perl
I wonder what's the best deployment directory for Rails apps? Some developers use directories
Rails uses the concept of migrations to deal with model changes using the ActiveRecord
Rails comes with a handy session hash into which we can cram stuff to
Rails introduced some core extensions to Ruby like 3.days.from_now which returns, as you'd expect
Rails gurus: I've just discovered named_scope thanks to another SO user. :) I'd like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.