I'm using cloud9 IDE and following the rails tutorial for beginners.
Why doesn't rails_4.2.0_ new hello_app (as written in the book) work.
The only thing it says on the terminal is rails rails_4.2.0_ "command not found"?
However, when typing, rails new hello_app 4.2.0 it works. When opening the GEMFILE in the text editor I have to adjust default gems to go along with the tutorial.
Is there a different version of rails comes up?
Thanks.
Type rails -v and find out what version you have. You can also just type rails new hello app and if you have rails 4.2.0 installed then it should use that version of rails. Make sure you run bundle update if you changed your gem file.
Related
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
I'm relatively new to Ruby, and Rails, I need to use Rails version 3.2.19, for some tutorials I'm following along, I get all kinds of errors trying to follow along with Rails 4...anyways, when I do: gem install rails --version=3.2.19, it shows that it installed it. When I do rails -v, it shows Rails 4.1.5....I thought maybe if I create a new Rails app, specifying version 3.2.19, that would work. Surprise, it showed up as Rails 4.1.5 in my Gemfile...what gives? I tried manually changing it in the Gemfile and running bundle install, but then everything breaks when I fire up the Rails server...I searched those errors on here, and no surprise, all the answers were about how those are errors when trying to use Rails 3, in an app that was generated with Rails 4.
I'm really stumped about this folks and would appreciate any help! Thanks in advance!
1)please install rvm if YES,check the rvm ls
and set ruby 1.9.3 as default.and then make new project
2)can you see the which version of ruby using if 2+ then it will be rails 4
if you want to use rails 3 then use 1.9.3 ...
Are you doing rails _3.2.19_ new myapp
when you're generating your app?
Also when you change rails version on your Gemfile, you have to run bundle update rails to update the version.
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
Currently going through a rails tutorial and I need to make some modifications to /config/initializers/secret_token.rb, however, I can't find this file anywhere within the initializers directory. I am running the latest version of rails. This is the line I used in the terminal to create a rails project:
rails new sample_app
Anyone know why it isn't showing up?
Thanks for pointing this out. The issue is probably due to using Rails 4.1 instead of Rails 4.0 as specified in the Rails Tutorial. It's because of issues like this that Section 1.2.2 states (bold in original)
Unless otherwise noted, you should use the exact versions of all software used in the tutorial, including Rails itself, if you want the same results.
To get things to work, first uninstall the current version of Rails:
$ gem uninstall rails railties
Then follow the instructions exactly as written in the tutorial to install Rails 4.0:
$ gem install rails --version 4.0.4
Generating a test app (skipping Bundler for convenience) and piping the output through grep then verifies that secret_token.rb gets generated:
$ rails -v
Rails 4.0.4
$ rails new test_app --skip-bundle | grep secret_token
create config/initializers/secret_token.rb
At this point, you should be able to follow the rest of the tutorial as written.
By the way, I'm about to start work on a 3rd edition of the tutorial, and will plan to take care of this issue as part of a more general update.
The tutorial you're looking at was likely written for an older version of Rails than you're using.
secret_token.rb existed in Rails 3 and Rails 4.0 apps; it does not exist in Rails 4.1 apps.
It has been replaced in Rails 4.1 by the secrets.yml file:
http://guides.rubyonrails.org/upgrading_ruby_on_rails.html#config-secrets-yml
I am using 4.1.1. Dont copy nothing to the secrets.yml, just dont forget to update the gitignore file (http://www.railstutorial.org/book/beginning#code-gitignore)
With this you can keep going on the tutorial
I have updated rails and have rails -v and it says 3.0.5. (which is good) when i open my old programs, will it still always use 3.0.4 as that is what was used?
And ..
when i create new one will it use 3.0.5
I have done this as i'm a newbie and having problems with tutorials from the rails by example book michael hartl and wondering if it is the version that is giving the problems.
Thanks for any help..
In Rails 3 Bundler was added to handle gem dependencies. Within each application a Gemfile exists that specifies the version of Rails to use. If you want to update an application change the version in your Gemfile and run bundle install.