Reputation: 1728
I've watched this presentation on how Bundler works and one of the reasons Bundler was invented was to solve 'activation errors', for eg:
LoadError: can't activate rack (~> 1.0.0, runtime) for ['actonpack-2.3.5'], already activated rack-1.1.0 for ['thin-1.2.7']
Does this basically means that you cannot run 2 different versions of the exact same gem at a same time, in a single Ruby process?
Upvotes: 1
Views: 53
Reputation: 28305
You cannot have two different versions of the same gem loaded the same program, because they could conflict and override each other's methods. For example, suppose you have a gem which contains the following:
# In gem version 1.0
class AneMaria
def self.name
"Ane"
end
end
######
# In gem version 2.0
class AneMaria
def self.name
"Maria"
end
end
And then in your code, if you call AneMaria.name
, what should it return??
One of the reasons tools like bundler
were created was to prevent this from happening accidentally -- so no, you cannot specify 2 different versions of a gem to load simultaneously. (Also, I don't think you'll ever want to do that!)
See also this post, which explains things a little more.
Upvotes: 3