one of the gems that one of my required gems installs is i18n-0.5.0.... which causes problems with my other gems...
but i18n-0.4.2 works.... but I can't have both, because the app favors the more recent i18n gem.
this is how I require the proper i18n:
config.gem 'i18n', :version => '0.4.2'
no greater than.
so.. two qusetions, why does it prefer the newer one, when I specify the older one?
how do I prevent 0.5 from installing?
I'm not sure of that but your problem could come from the 0.5.0 version of the gem wich is still install on your environment. Try a gem list I18n to see all the versions and if the 0.5.0 is here you can try :
gem uninstall I18n 0.5.0
This version was installed before and never remove. But with you new config it will not be re-installed with the rake gem:install command.
Related
I am trying to connect Rails to Sql Server so I need to use an Sql Server adaptor. I installed it by downloading the adaptor locally from github.com/Desarrollo-CeSPI/activerecord-sqlserver-adapter.git. After that I did: gem build activerecord-sqlserver-adapter.gemspec in the directory where I had the spec file, followed by gem install <name of gem that was just built>.
After that, I added this line in the gemfile:
gem 'activerecord-sqlserver-adapter', :path => 'downloads/activerecord-sqlserver-adapter-master\activerecord-sqlserver-adapter-master' , then I ran a bundle install from the project root.
The error is:
Bundler could not find compatible versions for gem "activerecord": In
Gemfile: rails <=4.1.6> x86-mingw32 depends on activerecord <=4.1.6>
x86-mingw32
activerecord-sqlserver-adapter <>=0> x86-mingw32 depends on
activerecord <4.0.0>
What is strange is rails -v doesn't return the rails version although I just installed it.
Instead it throws:
Could not find gem 'tzinfo-data <>=0> x86-mingw32 in the gems available on this machine
Run bundle install to install missing gems
I should specify we are compulsed to use proxies at work
Every few month I keep checking to see if the Sql Server connection is improved/easier to perform with Rails without adaptors and such, because I want to use Sql Server instead of PostgreSQL. No luck so far. Any help is much appreciated. Thanks
It looks like the gem that you are using only supports until rails 4.0.0 (the gemspec forces to be this version).
You might try to use that rails version to see what's going on.
To do so, in your Gemfile.rb you can try this:
gem 'rails', '4.0.0'
gem 'activerecord-sqlserver-adapter', git: 'https://github.com/Desarrollo-CeSPI/activerecord-sqlserver-adapter.git'
and then run
bundle update rails # to force using the rails version specified in the gemfile
and then run
bundle install
BUT
The gem that you are using has not been updated since 22nd August 2013, so I would not expect it work.
The gem that you are using is a fork of the original project located at https://github.com/rails-sqlserver/activerecord-sqlserver-adapter
If you don't have anything to do with Desarrollo-CeSPI, then you should use the official gem to avoid some problems, for instance that the gem is not maintained anymore.
I'm using the thumbs_up gem and on github there's a master branch (0.4.6) and an engine branch (0.3.2). When I require the gem in my Gemfile with
gem 'thumbs_up'
I see that version 0.4.6 was installed. I verify this is the right version running in my dev environment by doing bundle exec gem which thumbs_up and when I look at the VERSION file I see it's 0.4.6.
So when I look at the code I'm expecting to find an unvote_for method but it doesn't have one. Instead it has one called clear_votes. Now I'm confused because clear_votes is supposed to be in version 0.3.2 but as far as I can tell, I'm on version 0.4.6.
Any ideas what's going on here?
By default, the gem used is the latest available when running 'bundle install'. You can specify a version (or version constraints) in the Gemfile. To update the version of the gem used, you have to run bundle update <gemname>, and it will do so according to your gemfile.
About your problem : ensure that your server/console command is prefixed with bundle exec. You check also which versions of thumbs_up are installer on your system, and remove the version you don't need anymore.
You use Bundler so you can know which version of you gem is using in your Gemfile.lock. Bundler have and use only one version by gem.
I just updated the mime-types gem with gem update mime-types. gem list displayed mime-types (1.16) prior to updating. After the update gem list shows mime-types (1.17.2, 1.16). Why are two version displayed?
More info: I have other Rails projects on the same computer. I have not updated the mime-types gem in any other projects. Running gem list from another project's directory (where mime-types has not been updated) displays mime-types (1.16).
You have both versions installed. If you want to delete old versions (which will not always will be possible due to dependencies) use gem cleanup.
Which version of RubyGems do you have? gem -v
This is interesting: I have the newest version of RubyGems but my system behaves differently:
gem list => all the gems, all the versions. No matter from where I call it.
gem list --local => same as before but user-wide.
bundle list => all the gems in a project (one version per gem)
The same goes for bundle update and gem update.
bundle update replaces the old version by the new one (the dependencies are taken care by bundler), but gem update keeps both. So if you want to keep only the newest version, run gem cleanup.
bundle outdated might be useful: it displays the outdated gems in your project (based on rubygems.org)
This can happen because of gem dependencies.
For example if another gem depends on that gem, and the other gem does not have a version specified for it, and(/or) it gets updated and if its dependency on that gem's version changes... well you get the idea.
Sometimes I do a bundle and I see a ton of new versions getting downloaded. All due to changed... dependencies.
Rails is showing the validation messages on the page as such:
1 error prohibited this {{model}} from being saved
There were problems with the following fields:
{{attribute}} {{message}}
Wanting it to show the model names not these these brackets.
How do I fix it and why's it doing this?
This is a problem with internationalization in rails. One solution that has worked for some is to downgrade the internationalization gem from 0.5.0 to 0.4.2, like so:
sudo gem uninstall i18n
sudo gem install i18n -v 0.4.2
Of course, if you're using RVM to manage your gems, you don't need sudo in the commands above.
The proper solution involves using bundler to manage your gems instead of using the system defaults and the old Rails 2.x method of embedding it into environment.rb. Bundler segregates your application gems from your system gems properly and removes the problems that occur when using i18n versions 0.4.2 and 0.5 along with Rails 2.x and 3.x.
Steps:
Setup bundler for your Rails 2.3 app
http://gembundler.com/rails23.html
In your Gemfile, just completely leave out i18t.
Run 'bundle'
Note: If you do need i18n, just specify the correct version in the Gemfile. Bundler properly segregates your app's gems from your system gems so there will never be the strange behaviors of having both 0.4.2 and 0.5 installed on your system.
if you want to leave both gems installed, another solution is to create config/preinitializers.rb and add the line
gem 'i18n', '0.4.2'
While using Rails 2.3.5, even with config/preinitializers.rb containing
gem 'i18n', '0.4.2
and environment.rb containing
config.gem "i18n", :version => '0.4.2'
I had to uninstall version 0.5.0 of the i18n gem to make this work.
I have a rails app with the config/environment.rb line
config.gem 'authlogic', :version => '2.1.2'
The system gem for authlogic is 2.1.4
The one in my GEM_PATH is 2.1.2
No matter what I try, Rails is only using the 2.1.4 version, which is a problem. How to force rails to use 2.1.2?
Thanks
I recommend using Bundler
i've made a test here, included the gem authlogic, choose to use the 2.1.3 version, and the application ran without problems.
then i've uninstalled the gem (gem uninstall authlogic -v=2.1.3), and my application didn't ran anymore, normal behavior (i'm using rails 2.3.8 for this test)
you could try uninstalling and then installing the gem again
To be safe, uninstall your 2.1.4 version, freeze 2.1.2, then uninstall 2.1.2 too.
Unpack the gems into your rails app. This'll also help in deployment.
rake gems:unpack
Sys admin re-installed some gems and all the problems went away.