User314159
User314159

Reputation: 8065

ruby gems vs rails gems

Sorry if this is a newbie question but what exactly is the difference between the gem structure of a Ruby gem vs. a Rails gem?

Strictly speaking, all Rails gems are also Ruby gems, but not the other way around. So what additional files are required to make a ruby gem into a Rails gem?

For example, in this post, Building a ruby gem for Rails applications, the top answer suggests that all Rails gems need an init.rb. But then I found some rails gems that don't have the init.rb file. Here is an example: https://github.com/collectiveidea/awesome_nested_set

Basically, I want to write a Rails gem. I find a lot of tutorials on writing Ruby gems, but I just want to make sure it works for a Rails app.

Upvotes: 4

Views: 716

Answers (1)

Scott Hillson
Scott Hillson

Reputation: 853

To put it simply, rails is a ruby gem. A ruby gem is a ruby gem, and some are just built specifically for use with rails.

It's worth noting that gems and plugins are different, and you might be confusing the two:

Difference between plugins and Ruby gems?

Upvotes: 1

Related Questions