Mam potrzebę, aby aplikacja używała i18n w wersji 0.1.3, czyli tej z railsów 2.3.5, a nie brała mi najnowszego posiadanego gema, bo się momentami kaszani.
config.gem i :version w environment.rb nie sprawdza się, bo to już jest załadowane wcześniej. W związku z tym gdzie wcześniej mogę temu zapobiec?
Do tego służy metoda Kernel#gem
Wpisz w konsoli:
ri Kernel#gem
->
[code]------------------------------------------------------------- Kernel#gem
gem(gem_name, *version_requirements)
Use Kernel#gem to activate a specific version of +gem_name+.
+version_requirements+ is a list of version requirements that the
specified gem must match, most commonly "= example.version.number".
See Gem::Requirement for how to specify a version requirement.
If you will be activating the latest version of a gem, there is no
need to call Kernel#gem, Kernel#require will do the right thing for
you.
Kernel#gem returns true if the gem was activated, otherwise false.
If the gem could not be found, didn't match the version
requirements, or a different version was already activated, an
exception will be raised.
Kernel#gem should be called *before* any require statements
(otherwise RubyGems may load a conflicting library version).
In older RubyGems versions, the environment variable GEM_SKIP could
be used to skip activation of specified gems, for example to test
out changes that haven't been installed yet. Now RubyGems defers to
-I and the RUBYLIB environment variable to skip activation of a
gem.
Example:
GEM_SKIP=libA:libB ruby -I../libA -I../libB ./mycode.rb[/code]
Jeśli się nie mylę, do 2.3.4 działało tak jak piszesz - brało bez pytania własną wersję z active_support/vendor/i18n-0.1.3.
Porównaj różnice w activesupport-2.3.5/lib/active_support/vendor.rb i activesupport-2.3.4/lib/active_support/vendor.rb i chyba znajdziesz rozwiązanie, ale nie wiem jak to zmienić bez patchowania.
BTW: w 2.3.6 będzie jeszcze jedna zmiana: https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/2871