Setting up rails, created a directory, wondering where to install rails

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.

On Apr 19, 2014, at 2:38 PM, Matt K. wrote:

“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.

Walter

On 19 April 2014 21:02, Matt K. [email protected] wrote:

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.

Colin

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

On Sun, Apr 20, 2014 at 1:32 AM, Matt K. [email protected]
wrote:

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?

​Try Michael H.'s tutorial which explains rails development end​ to
end

http://ruby.railstutorial.org/ruby-on-rails-tutorial-book?version=4.0

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

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?

Also is there a safe way to exit the server without closing the
terminal?

On 19 April 2014 21:18, Matt K. [email protected] wrote:

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
will have created a folder . Just delete it. Everything
about that project is stored in that folder.

Colin

On 19 April 2014 21:32, Matt K. [email protected] wrote:

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.

Colin

Not necessary.

But go ahead if it’ll make you feel better.

You’re overthinking this. It’ll just work.

Colin L. wrote in post #1143559:

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?

EDIT - why every time i close the terminal and go back to my app folder
and try to run the “rails server” command in the terminal it says "Rails
is not currently
installed on this system. To get the latest version, simply type:

$ sudo gem install rails

"

It only seems to work when I do it all at once then when I close the
terminal, rails disappears

EDIT-2- it works when I paste in this: “source ~/.rvm/scripts/rvm”

On 19 April 2014 21:55, Matt K. [email protected] wrote:

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.

Colin