rails _5.0.1_ new toy_app installs 5.1.1 version - ruby-on-rails

I am pretty new in Ruby in Rails, I was trying to follow https://www.railstutorial.org/book/toy_app and learn a bit. I tried rails _5.0.1_ new toy_app command but all the time I was getting 5.1.1 version and I had some compatibility problems because of that.

So as I wrote in comment, the solution for that was to install gem install rails -v 5.0.2 and then start project rails _5.0.2_ new toy_app, still weird cause that installed me 5.0.3 version, but it works fine now, I solved all compatibility issues.

Related

Can I specify my Rails version using .asdf version manager?

Currently I have asdf for managing my versions of Ruby (2.6.5), nodejs, and yarn. I am trying to follow a Rails tutorial with version 5.2.1.
Running gem install rails -v 5.2.1 and
rails new appname version=5.2.1.
It still says version 6.0.2.1 application. I am new to Ruby on Rails so there could be something obvious I'm missing or I'm making a bigger deal out of this than it needs to be. But I'd like to follow this rather long tutorial as close as possible. I believe it is installing the correct version of rails under this path.
~/.asdf/installs/ruby/2.6.5/lib/ruby/gems/2.6.0/gems/rails-5.2.1/
Any help would be greatly appreciated. Medium blog ...
Try this
rails _5.2.1_ new appname

RubyMine 8 development not working. Keeps saying No Rails Found in SDK

Title kind of explains it. In both the Development Configuration and Preferences -> Languages -> Ruby SDK and Gems settings I have the correct Ruby version/Gemset selected. But it still just saying:
Error running Development: the_factory: [No Rails found in SDK]
I've used RubyMine on tons of projects and this has never given me a problem. But this is a new project, using Rails 5 and Ruby v2.3.0, and I just can't figure out what's going on here.
This is in Ruby SDK and Gems settings in RubyMine 8:
And this is my Development config:
Update
When I run rails server in my project folder, it works as expected.
Ok, so I checked it out a little on RubyMine help page and I found this magical phrase:
RubyMine supports Ruby versions 1.8.6 to 2.2
So I removed my rvm Ruby 2.3 version, installed Ruby 2.2.4, create a gemset with Rails 5. Then I assigned that gemset to my project and Voilá! It worked as expected.
Note: This answer my specific question at the date I write this. But this obviously is not a long term answer, so if you are a future boy/girl with this very same problem, first check if your RubyMine version support Ruby >v2.3 before remove your current Ruby version.
For me the solution was that I had several Rails gem versions installed in my project directory.
gem uninstall rails
was the way to go, removing any unwanted versions. Feels like a contradiction - but uninstalling Rails meant that RubyMine could find Rails.

installing rails 4.0.5 for Michael Hartl tutorial

Fairly new to all this, so please do excuse the novice in me. So I just purchased the full package from Michael Hartl's rails tutorial website. I am running into some issues setting up the dev environment.
I used Rails Installer to get things going, and it installed the works. The only issue here is that it installed a version of Rails newer than 4.1, to follow Hartl's tutorial I need 4.0.5. When I type in gem rails -v in the CMD, it says Rails 4.1.1.
How would I go about installing an older version, such as 4.0.5, and having only that one run, instead of 4.1.1?
I do appreciate all the help as I am very eager to get started with RoR and to follow Hartl's tutorial. He does say in the tutorial that it will not work if I am not able to install the correct versions of Rails, so I am really stuck here.
Thank-you.
edit: I am on Windows 7, and am using Sublime Text Editor 3 as well.
First install the version that you want, as others said in the comments:
gem install rails -v 4.0.5
Then just create the new project as follows:
rails _version_ new appName
Using your desired version:
rails _4.0.5_ new appName
This way the project will be created with the version specified.
Don't worry if you have more than one version of Rails installed

Mac OSx Lion - Cannot get RoR installed

I recently upgraded to Lion and I am trying to install Rails. I used RubyGems to install rails and each time I tried to start a new rails project I would get an error saying, "Method 'list ' was not found".
So I unistalled Rails using RubyGems. I noticed I had two versions installed. I uninstalled both. I then ran 'gem clean'. Once again I installed Rails but now when I attempt to create a new rails application it's as if rails is not installed.
rails: command not found
I have the new Xcode command line tools installed. Can anyone help a brother out?
I believe my issue is due to the fact RubyGem does not add 'rails' to the $PATH environment variable. I was able to get everything working by installing RVM and using it to update my default Ruby and install Rails

Rails 2.3.2 app and rails 3 app on the same machine

I upgraded to the latest Rails v3.1.3. And everything is fine, I'm able to run the 2.3 version of one website and the app for v3.1.3.
However I couldn't move it to a new machine, I installed all the required gems with
bundle install
and just cannot start Thin with the 2.3.2 version. I can only run the v3 apps. Thanks
Go read about RVM, and try to configure you machine according to the instructions given there.
As #Syed Aslam said the ideal way of doing is using RVM, but you may set bundler to your Rails 2.x project (because rails 3.x already have bundler..) and run both your projects in the same machine (actually currently I'm doing that).
Following is a tutorial how setting up bundle with Rails 2.x.

Resources