Hello, its my first time using ruby or the terminal, I am on Mac OS X
Mavericks.
I am trying to set up ruby on rails, I have got the rvm installed, I
have also created a
"mkdir rails_projects" and I have "cd rails_projects"
However, I haven't yet install rails, I did it on purpose because I
heard that its better to install it in each project separately instead
of globally. I am however, lost as to where in the project i should
install it at? is it ok if I install in my project directory
"rails_projects" that I created through mkdir? Thank you guys
Just do ‘gem install rails’. You can be in the project directory but I don’t think you need to since it will go to a global copy in the .rvm directory of your home directory. I never even worried about where it goes. Especially if you are new to this, it’s not a thing I would worry about.
Type gem env from a terminal to see where things are installing to. Maybe also look at this:
Do gem list and you’ll see what versions you have installed locally. That can be done either inside or outside a project directory.
When you create your new app, you can edit the gemfile and specify specific versions of things in you want. The gem install rails will get you rails 4.1.x but that’s probably what you want now if you’re just getting started. It’s the latest and it works fine for me (ok with a little trouble with turbolinks and some jquery). Older blog posts will likely be describing rails 3.2 or 4.0. If you change your gemfile to reference 3.2 that will load when you bundle.
Once you create a specific project, do bundle list to see what gems are being used for that particular project.
You can even do things like specifying the ruby version you want for each particular directory (1.9) but just pick a default with the rvm and stick with it for now.
Also, you can put the directory anywhere you want. I have a sandbox directory in my home with a rails subdirectory.
Hello, its my first time using ruby or the terminal, I am on Mac OS X
Mavericks.
I am trying to set up ruby on rails, I have got the rvm installed, I
have also created a
"mkdir rails_projects" and I have "cd rails_projects"
However, I haven't yet install rails, I did it on purpose because I
heard that its better to install it in each project separately instead
of globally. I am however, lost as to where in the project i should
install it at? is it ok if I install in my project directory
"rails_projects" that I created through mkdir? Thank you guys
Rails, like any other Ruby gem, is installed in your gems directory, and a binary `rails` application is also installed somewhere executable in your PATH so you can have the command-line tools. It doesn't matter where you "are" when you install it, because it will always end up in the same place (wherever `gem env` tells you your installation directory is).
When you run `gem install rails`, you will get the latest version of Rails. And if you use `rails new widgets` in your projects directory, you will end up with a new folder named widgets, and the entire rails project stubbed out inside there. There will be a 1:1 dependency on the version of Rails that you used when you ran that command, and this dependency will be hard-coded into your Gemfile, which tells Bundler which version of Rails to use when starting your application and running any commands. You don't need to worry about this, it is all taken care of for you.
A year from now, if you wanted to go back in time and use an older version of Rails to start a new project, after you've installed two other versions of Rails in the interim, you could use this syntax: `rails _4.0.4_ new anotherwidgetsite` and use that version.
Thank you guys, this is what I did, apparently it is project specific
$ mkdir myapp
$ cd myapp
$ rvm use ruby-2.1.1@myapp --ruby-version --create
$ gem install rails --pre
$ rails new .
I have also got the ruby server running, but have no idea how to start
programming with ruby. I am using TextMate, so if I write some code now
where should I exactly save that file to?
Thank you
Thank you guys, this is what I did, apparently it is project specific
$ mkdir myapp
$ cd myapp
$ rvm use ruby-2.1.1@myapp --ruby-version --create
$ gem install rails --pre
$ rails new .
I have also got the ruby server running, but have no idea how to start
programming with ruby. I am using TextMate, so if I write some code now
where should I exactly save that file to?
If you want to use rails then work right through a good tutorial such
as railstutorial.org, which is free to use online.
If you just want to write scripts in ruby then you can save the files
wherever you like.
Ok thank you guys, how would I go about to delete the project I have
already created and start from scratch using that tutorial as it has
different setup
Ok thank you guys, how would I go about to delete the project I have
already created and start from scratch using that tutorial as it has
different setup
rails new <whatever>
will have created a folder <whatever>. Just delete it. Everything
about that project is stored in that folder.
the hierarchy looks like this: rails_projects => my app
is it enough to delete myapp or should I also delete the rails_project
folder I have created earlier?
the hierarchy looks like this: rails_projects => my app
is it enough to delete myapp or should I also delete the rails_project
folder I have created earlier?
Please remember to quote the previous message when replying, and
insert your reply at appropriate point(s). It makes it easier to
follow the thread. Thanks.
It is of no consequence whether you delete it or not. There is no
need even to delete the old rails app, it is just a folder with an app
in it. It will not do anything unless you go in and run the server.
By the way, at least while learning, I advise against using an IDE.
You will learn more by using just an editor (preferably with ruby
syntax knowledge) and running commands in the terminal.
Please remember to quote the previous message when replying, and
insert your reply at appropriate point(s). It makes it easier to
follow the thread. Thanks.
It is of no consequence whether you delete it or not. There is no
need even to delete the old rails app, it is just a folder with an app
in it. It will not do anything unless you go in and run the server.
By the way, at least while learning, I advise against using an IDE.
You will learn more by using just an editor (preferably with ruby
syntax knowledge) and running commands in the terminal.
Colin
Alright thank you, do you happen to know any reputable videos?
Start with railstutorial.org. Work right through it and it will give
you a good grounding in Rails. There are also the Rails Guides and
the Railscasts, but I suggest starting with the tutorial. Nothing
compares to actually sitting down, putting in the code and running it,
it worked for me at least.