Forum: Ruby on Rails Setting up rails, created a directory, wondering where to install rails

8517b3a6c3299479a1422ed8be13e3d8?d=identicon&s=25 Matt Kazuka (kelmeskrazante)
on 2014-04-19 20:38
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
72d362060aed96f3de7e1d4ca54f3dcc?d=identicon&s=25 Scott Eisenberg (Guest)
on 2014-04-19 21:28
(Received via mailing list)
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:

http://stackoverflow.com/questions/3408868/where-d...

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.
A47e0a6beeb9d048ff054fc1c3a97418?d=identicon&s=25 Walter Davis (walterdavis)
on 2014-04-19 21:29
(Received via mailing list)
On Apr 19, 2014, at 2:38 PM, Matt Kazuka 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
8517b3a6c3299479a1422ed8be13e3d8?d=identicon&s=25 Matt Kazuka (kelmeskrazante)
on 2014-04-19 22:02
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
4c6bde00168d595053c09aac7e487f8e?d=identicon&s=25 Colin Law (Guest)
on 2014-04-19 22:12
(Received via mailing list)
On 19 April 2014 21:02, Matt Kazuka <lists@ruby-forum.com> 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
61b2cb27fe3d25f42ecc0364c33420f8?d=identicon&s=25 Ganesh Ranganathan (Guest)
on 2014-04-19 22:14
(Received via mailing list)
On Sun, Apr 20, 2014 at 1:32 AM, Matt Kazuka <lists@ruby-forum.com>
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 Hartl's tutorial which explains rails development end​ to
end

http://ruby.railstutorial.org/ruby-on-rails-tutori...
8517b3a6c3299479a1422ed8be13e3d8?d=identicon&s=25 Matt Kazuka (kelmeskrazante)
on 2014-04-19 22:18
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
4c6bde00168d595053c09aac7e487f8e?d=identicon&s=25 Colin Law (Guest)
on 2014-04-19 22:29
(Received via mailing list)
On 19 April 2014 21:18, Matt Kazuka <lists@ruby-forum.com> 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 <whatever>
will have created a folder <whatever>.  Just delete it.  Everything
about that project is stored in that folder.

Colin
8517b3a6c3299479a1422ed8be13e3d8?d=identicon&s=25 Matt Kazuka (kelmeskrazante)
on 2014-04-19 22:32
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?
4c6bde00168d595053c09aac7e487f8e?d=identicon&s=25 Colin Law (Guest)
on 2014-04-19 22:41
(Received via mailing list)
On 19 April 2014 21:32, Matt Kazuka <lists@ruby-forum.com> 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
72d362060aed96f3de7e1d4ca54f3dcc?d=identicon&s=25 Scott Eisenberg (Guest)
on 2014-04-19 22:42
(Received via mailing list)
Not necessary.

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

You're overthinking this.  It'll just work.
8517b3a6c3299479a1422ed8be13e3d8?d=identicon&s=25 Matt Kazuka (kelmeskrazante)
on 2014-04-19 22:55
Colin Law 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"
4c6bde00168d595053c09aac7e487f8e?d=identicon&s=25 Colin Law (Guest)
on 2014-04-19 23:06
(Received via mailing list)
On 19 April 2014 21:55, Matt Kazuka <lists@ruby-forum.com> 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
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.