问题
I am facing issue when I am trying to work with rails 3.0.11. I initially worked with rails 3.2.6. Build a prototype application in Rails 3.2.6, Ruby 1.9.2 and gem 1.8.7. But then found, server on which we need to host is a shared server which can only support Rails 3.0.11, Ruby 1.8.7 and gem 1.7.2.
Hence I want to keep my dev environment exactly same before I ran into further issues. As I found there was some discrepancy in routes.rb of both the versions.
Steps I followed:
- Uninstalled rails
- Uninstalled ruby
- Installed ruby from here.
- This installed ruby version 1.8.7-p370 and gem 1.8.7
- After this I installed rails by specifying version as 3.0.11
But still when I run command rails -v, it throws an error to me saying 'missing gem rails 3.2.6. Run bundle install to resolve the issue'
When I ran bundle install, it again completely installed rails 3.2.6 and problem remained unresolved.
Please suggest the clean way how shall I start my development on rails 3.0.11 without running into any issues?? Am I need to delete some registry or mapping in my system through which it is detecting rails 3.2.6 and creating issues??
Its urgent as I need to complete my dev by 7th September.
As I am new to stackexchange, please guide is it appropriate to ask question on the same related thread or shall I open new discussion for my problem?
回答1:
@Gun - please note in response to one of your comments posted above - you DO need to change your Gemfile - if you are running rails -v
from withing your project's directory, it will read the Gemfile.
There is a script located at script/rails
- this is what runs when you run the rails command from the project directory. NOTE that this rails script requires your config/application.rb
file - which in turn reads the Gemfile and bundles the referenced gems. Thus is your Gemfile still references 3.2.6, and it is not installed, rails -v
will not work
Glad to hear the problem is fixed :)
As for the asset pipeline - if you are using rails 3.2.6 (or were using it) then you may have been using the asset pipeline to serve your assets (javascript files, CSS files, images, etc). If you were, and you downgrade to anything pre rails version 3.1, then anything being served through the asset pipeline will no longer work.
Here is a pretty good description of the asset pipeline: http://guides.rubyonrails.org/asset_pipeline.html
回答2:
You should check also remove your Gemfile.lock or manually 'bundle update rails' when you change your rails dependency.
回答3:
I suggest to use rbenv or rvm to create a virtual environment/sandbox where you can install your preferred ruby versions (e.g. 1.8.7) and keep tracking of your dependencies separately. This would save you a lot of effort.
Keep in mind that rails 3.0 has no asset pipeline support (it has been included in rails 3.1)! This is a very important difference and if you depend on it you will have big issues to solve for the downgrade.
回答4:
Thanks a lot everyone for help.
I believe it was weird issue. I had heroku on the system. I was initially deploying my app on the same and then changed to another hosting server. After uninstalling the heroku, it works perfectly fine. Probably, that was interfering somewhere. Although, not sure but problem is resolved.
Thanks a lot again for a great great help!!!
Meanwhile, I would request alup to throw some more light on asset pipeline support. Wots that? Could you please explain more??
回答5:
Need to delete C:\Users\.ror folder and C:\Users\.gemfile and C:\Users\.gemfile.lock from your desktop..
来源:https://stackoverflow.com/questions/12200104/downgrading-from-rails-3-2-6-to-3-0-11