Kevin Sylvestre
Kevin Sylvestre

Reputation: 38012

Convention For Gem with Common Name

I recently authored a gem called 'setting' (found here). The extends ActiveRecord with a module named 'Setting'. I understand that gems are supposed to use the namespace they are named, however when testing this caused collisions with ActiveRecord models with the same name (a Setting model). Does a standard exist for creating a private module namespace? I don't need users of the gem to ever access the module outside the extension in ActiveRecord. Do I have any options outside of picking a less common name?

Upvotes: 2

Views: 84

Answers (1)

molf
molf

Reputation: 74945

Since you're writing an Active Record extension, you could place your module inside the ActiveRecord namespace:

module ActiveRecord
  module Setting
  end
end

Other than that, no, there's no practical namespace solution for gems with very common names.

Upvotes: 1

Related Questions