A Ruby Book (free to use)

298 views
Skip to first unread message

Karthikeyan A k

unread,
Aug 22, 2012, 2:13:05 AM8/22/12
to rubyonra...@googlegroups.com
Hello people, I have written a book on Ruby programming language.
Download it from here http://is.gd/r2012

--
Posted via http://www.ruby-forum.com/.

Balaraju Vankala

unread,
Aug 27, 2012, 7:40:14 AM8/27/12
to rubyonra...@googlegroups.com
Hey Thank you .... i downloaded it just now.

Gintautas Šimkus

unread,
Aug 27, 2012, 7:48:32 AM8/27/12
to rubyonra...@googlegroups.com
+1 for Balaraju for learning (context is out there in another thread).

2012/8/27 Balaraju Vankala <li...@ruby-forum.com>
Hey Thank you .... i downloaded it just now.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.





--
Pagarbiai,
Gintautas

Karthikeyan A k

unread,
Aug 27, 2012, 7:49:11 AM8/27/12
to rubyonra...@googlegroups.com
Try to spot mistakes in it!! And if you can give me a feedback.

TBIKC TBIKC

unread,
Aug 27, 2012, 8:00:15 AM8/27/12
to rubyonra...@googlegroups.com
Karthikeyan A k wrote in post #1073093:
> Try to spot mistakes in it!! And if you can give me a feedback.

161 page, the first paragraph
but when I gave ilr to them

What is "ilr" ?

Karthikeyan A k

unread,
Aug 27, 2012, 8:01:48 AM8/27/12
to rubyonra...@googlegroups.com
OK, its the short form of I Love Ruby.

Dheeraj Kumar

unread,
Aug 27, 2012, 8:39:22 AM8/27/12
to rubyonra...@googlegroups.com
Too many spelling and grammatical errors, use of SMS lingo, usage of culturally and geographically local references which may/will not be understood by the global population.

Your effort is commendable, I appreciate the time and effort you put in to write a book. I know writing a book is not trivial to accomplish, but your book sucks.


Dheeraj Kumar

Karthikeyan A k

unread,
Aug 27, 2012, 9:47:12 AM8/27/12
to rubyonra...@googlegroups.com
Thanks, don't read it then.

Dheeraj Kumar wrote in post #1073453:
> Too many spelling and grammatical errors, use of SMS lingo, usage of
> culturally and geographically local references which may/will not be
> understood by the global population.
>
> Your effort is commendable, I appreciate the time and effort you put in
> to write a book. I know writing a book is not trivial to accomplish, but
> your book sucks.
>
>
> Dheeraj Kumar

jason white

unread,
Aug 27, 2012, 9:52:15 AM8/27/12
to rubyonra...@googlegroups.com
At a first glace, it seems to be very well thought out, and I look forward to digging in deeper. Thank you for taking the time to share with us.

Jason

Oğuz Demirkapı

unread,
Aug 27, 2012, 10:16:22 AM8/27/12
to rubyonra...@googlegroups.com
I love Shriya Saran. :)

Thanks for the book. 


/OD
@demirkapi

Bruce Whealton

unread,
Aug 27, 2012, 11:07:28 AM8/27/12
to rubyonra...@googlegroups.com
Hello all,
        For some reason, Ruby on Rails is one of the hardest programming languages that I’ve ever tried to get up and running with it.  I have used python, perl, php, java, javascript, etc.
Can someone recommend a good IDE that is free – at this point I need that – Please.  I have both RadRails, which often gets described as an Eclipse Plugin – maybe I should instead just start with Eclipse and install
Ruby on Rails for Eclipse.  I also have NetBeans.  Can someone recommend an IDE for Windows.  (and separately if it works in Linux).
I took a course on Lynda.com on Ruby and then on Ruby on Rails and got stuck at the part where I create the first app and then try the Webbrick server. 
         I can work with Ruby.  I’d now like to work with Ruby on Rails.
        I do have a dedicated server and I can install gems from the cpanel.  I don’t know how that is at learning Rails.  For example, are there ways to create a ruby on rails application from the cpanel?
        While I am trying to get started with Linux, I would like to be able to do this in Windows.  The course I am taking is using Windows or Mac.  I don’t have a mac yet.
Thanks,
Bruce

Dheeraj Kumar

unread,
Aug 27, 2012, 11:17:04 AM8/27/12
to rubyonra...@googlegroups.com
Hi Bruce,

I can understand the problems you're going through, as I've faced them myself. They stem from some misconceptions about the language & the framework. 

Getting started with rails is probably the easiest thing to do out of all the language stacks available. If you're using OSX or Linux, use https://github.com/joshfng/railsready on a fresh install of your OS, and you're set.

Remember that developing rails on Windows is not that easy, since Ruby runs best on *nix environments like OSX or Linux. On Windows, Ruby runs on an emulation layer like Cygwin, which should probably work 90% of the time, but it's largely unsupported by the rails community. 


Dheeraj Kumar

Dheeraj Kumar

unread,
Aug 27, 2012, 11:28:20 AM8/27/12
to rubyonra...@googlegroups.com
You can try NetBeans, but I'd suggest you NOT to use an IDE. Using an IDE with Ruby does not massively boost your productivity unlike other languages like Java or .NET (Visual Studio is probably one of the best IDEs I've ever used)  

In fact, I found that I work much faster with the terminal and an awesome text editor like TextMate for Mac or Sublime Text 2 for Windows/Linux/Mac. 

Most Ruby on Rails developers start with Agile Web Development with Rails - http://pragprog.com/book/rails4/agile-web-development-with-rails and/or http://ruby.railstutorial.org/

For ruby, there's the Pickaxe book - http://pragprog.com/book/ruby3/programming-ruby-1-9

Most of us just list the gem we want in our Gemfile, and run the `bundle` command to install the gems we need for the app. Rails encourages you to get down and dirty with development, testing and deployment of your app, so GUIs, management consoles like Cpanel, etc are largely not favored by the community.

These are just my views and experiences with the Rails ecosystem. YMMV :)


Dheeraj Kumar

ANIKET KADAM

unread,
Aug 27, 2012, 11:37:53 AM8/27/12
to rubyonra...@googlegroups.com
hi dheeraj, i m also having same problem but can you tell me it is a good idea to learn ruby side by side while learning rails and
what this article means about rails4 => http://blog.phusion.nl/2012/08/03/why-rails-4-live-streaming-is-a-big-deal

can we make real time web app in rails 4 => http://www.youtube.com/watch?v=g3O1PgvUzpo

thanks in advance

Colin Law

unread,
Aug 27, 2012, 11:37:59 AM8/27/12
to rubyonra...@googlegroups.com
On 27 August 2012 16:07, Bruce Whealton <br...@whealton.info> wrote:
> Hello all,
> For some reason, Ruby on Rails is one of the hardest programming
> languages that I’ve ever tried to get up and running with it. I have used
> python, perl, php, java, javascript, etc.
> Can someone recommend a good IDE that is free – at this point I need that –
> Please. I have both RadRails, which often gets described as an Eclipse
> Plugin – maybe I should instead just start with Eclipse and install
> Ruby on Rails for Eclipse. I also have NetBeans. Can someone recommend an
> IDE for Windows. (and separately if it works in Linux).
> I took a course on Lynda.com on Ruby and then on Ruby on Rails and got stuck
> at the part where I create the first app and then try the Webbrick server.
> I can work with Ruby. I’d now like to work with Ruby on Rails.
> I do have a dedicated server and I can install gems from the cpanel.
> I don’t know how that is at learning Rails. For example, are there ways to
> create a ruby on rails application from the cpanel?
> While I am trying to get started with Linux, I would like to be able
> to do this in Windows. The course I am taking is using Windows or Mac. I
> don’t have a mac yet.

If you /must/ use windows then I gather that railsinstaller.org may be
the easiest way to do it. Much better to use linux (I use Ubuntu).
You can run that in a virtual machine on windows if you want, or dual
boot the pc with win and ubuntu. Do use rvm to manage ruby and gems
if you are on Linux or Mac.

As others have said most don't bother with an IDE, just use a decent
editor (I use jEdit) with ruby syntax plugin and the console. You
will find yourself doing very little true debugging in Rails and most
books and tutorials will use the console. railstutorial.org is good
and is free to use online.

Colin

jason white

unread,
Aug 27, 2012, 11:41:21 AM8/27/12
to rubyonra...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Rails Ready https://github.com/joshfng/railsready on Ubuntu will give you everything you need to get started

Jason

Colin Law

unread,
Aug 27, 2012, 11:42:50 AM8/27/12
to rubyonra...@googlegroups.com
On 27 August 2012 16:17, Dheeraj Kumar <a.dheer...@gmail.com> wrote:
> Hi Bruce,
>
> I can understand the problems you're going through, as I've faced them
> myself. They stem from some misconceptions about the language & the
> framework.
>
> Getting started with rails is probably the easiest thing to do out of all
> the language stacks available. If you're using OSX or Linux, use
> https://github.com/joshfng/railsready on a fresh install of your OS, and
> you're set.

I have not met that one, it seems as if it may be more geared towards
a production server than development. I believe most would not use
passenger, nginx or apache on development machines.

This one looks like a reasonable alternative tutorial for installing
http://blog.sudobits.com/2012/05/02/how-to-install-ruby-on-rails-in-ubuntu-12-04-lts/

Colin

Dheeraj Kumar

unread,
Aug 27, 2012, 11:56:36 AM8/27/12
to rubyonra...@googlegroups.com
@Colin:

Railsready can be used for any environment. The only thing it installs that is not usually used for a development environment is Passenger. Railsready is great because it simplifies the task of installing dependencies. I've done it manually, and this is so much more fun :)


Dheeraj Kumar

Dheeraj Kumar

unread,
Aug 27, 2012, 12:09:20 PM8/27/12
to rubyonra...@googlegroups.com
@Aniket Kadam:

Once you start with Rails, you'll find that you pick up Ruby automatically. However, at some point along the way, you'll find that investing some time into properly learning Ruby, using books like The Pickaxe Book and Metaprogramming Ruby. They make your life /much/ easier.

Yes, Rails4 does support live streaming. If you have a question about it, I suggest you start a new thread, so that this thread can continue about new developers and the problems they face.


Dheeraj Kumar

Karthikeyan A k

unread,
Aug 27, 2012, 1:02:06 PM8/27/12
to rubyonra...@googlegroups.com
OK people,

Just updates some stuff, especially the ones spotted in this thread
http://www.ruby-forum.com/topic/440505 , new updated book is now
available in http://is.gd/r2012

Enjoy! ;-)

Max

unread,
Aug 27, 2012, 1:45:52 PM8/27/12
to rubyonra...@googlegroups.com
skimming through the book - your section at the end where you show a proof that 1 = 2... absurd from what I can see...

on line 3 you say:

1 - 1 = (1 + 1)(1-1)
and evalueat it to:

1-1/1-1 = 1 + 1...

how can you come up with that?
as far as I can tell it evaluates to:
1-1 = 2 * 0
0 = 0

???  so all the rest of you "logic" is wrong. 

Colin Law

unread,
Aug 27, 2012, 3:30:40 PM8/27/12
to rubyonra...@googlegroups.com
On 27 August 2012 18:45, Max <aa...@xmission.com> wrote:
> skimming through the book - your section at the end where you show a proof
> that 1 = 2... absurd from what I can see...
>
> on line 3 you say:
>
> 1 - 1 = (1 + 1)(1-1)
> and evalueat it to:
>
> 1-1/1-1 = 1 + 1...

If you allow zero divided by zero you can prove anything you like
(more or less). Zero divided by zero is meaningless.

Colin

>
> how can you come up with that?
> as far as I can tell it evaluates to:
> 1-1 = 2 * 0
> 0 = 0
>
> ??? so all the rest of you "logic" is wrong.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-ta...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/zc6zwmEr3kkJ.

Bruce Whealton

unread,
Aug 27, 2012, 9:15:19 PM8/27/12
to rubyonra...@googlegroups.com
Hello,
          Thanks for your feedback.  I guess I will have to share with you the problem I am having with Linux installations too.  Anyway, I am taking a course on Lynda.com for learning and the instructor doesn’t go into Linux for some reason.  He discusses Ruby on Rails for Mac and Windows.  There is a course also on Ruby which ran fine on Windows. 
         I have used various PHP frameworks, like Zend, Cakephp, Synphony. 
        Getting back to the course, unfortunately, he doesn’t cover any IDE for doing development with Ruby On Rails.  That’s why I was looking for suggestions for a development tool, IDE, that is free.  Aptana, Netbeans, Eclipse, RadRails?
        I have VirtualBox and can use that.  However, first I want to say that I would like to be able to follow the course material that does use Windows (also Mac OS X, which I don’t have).  Again, strangely as it seems, it is the hardest, most frustrating effort to get started with Ruby on Rails among all the language stacks (other stacks, I guess were the php stacks), and languages I’ve used.  On Windows, I ran into problems with both installing the rails project on my xampp area and using the WebBrick server.  Then I tried using Linux Ubuntu Server 12.04 and ran into problems when I tried various online tutorials for how to install and get up and running with Ruby on Rails for Linux Ubuntu server.  Someone on this list did send me a link to yet another tutorial for Linux. 
       I suppose I am not so great at using terminal command line apps (like Putty for windows) as the text often flies by and it’s hard to read.  Plus, I’m not clear how to copy the text when it displays errors during a process to be able to share them on a list and ask what is going wrong? 
        It’s not a matter of not understanding the concept of the framework, it’s the fact that it isn’t working in any environment, using an IDE or no IDE, or etc. 
         This is far and above the most difficult language and framework that I’ve ever encountered.  I’ve never before spent day after day just to get a language or language stack setup and to have a application created and to be able to go to a website and see it.  There are many conceptual things I need to learn about the php language stacks but at least in the first sitting, within a couple hours if not much, much sooner, I had an MVC application installed and I could browse to it.
thanks,
Bruce

Dheeraj Kumar

unread,
Aug 28, 2012, 2:14:41 AM8/28/12
to rubyonra...@googlegroups.com
Like I said, most ruby/rails developers do not use an IDE, as it isn't necessary at all. When you start working with the console, you'll be much faster and more efficient than you will with an IDE.

Install ubuntu on a virtualbox, run RailsReady (make sure you select to install with RVM, when RailsReady asks you) and you're good to go. It shouldn't take you more than 45 minutes from opening virtual box to starting to work on rails with everything installed.

If you are not good at using the terminal, you will improve when you start using it. If text flies by, scroll up to read it. If its unreadable, increase your font size. Copying is usually Control+Shift+C, at least in the ubuntu terminal. Select text with your mouse and you can even right click and click copy.

Getting support on Windows is a really hard thing, and it's like trying to fit a car engine in a motorbike, so why not go native on Linux?


Dheeraj Kumar

Karthikeyan A k

unread,
Aug 28, 2012, 3:32:20 AM8/28/12
to rubyonra...@googlegroups.com
LOL! All know its absurd, don't u ppl have a sense of humour or
something?

Max wrote in post #1073493:

Michael Pavling

unread,
Aug 28, 2012, 3:50:58 AM8/28/12
to rubyonra...@googlegroups.com
On 28 August 2012 08:32, Karthikeyan A k <li...@ruby-forum.com> wrote:
> LOL! All know its absurd, don't u ppl have a sense of humour or
> something?

Is it supposed to be a joke book, or a tutorial?

Dheeraj Kumar

unread,
Aug 28, 2012, 5:16:42 AM8/28/12
to rubyonra...@googlegroups.com
I thought he was trolling too. Then I realized he wasn't. My friends had a pretty good laugh about this.. there are plenty of WTF moments  :D


Dheeraj Kumar

Hasan Diwan

unread,
Aug 28, 2012, 9:22:42 AM8/28/12
to rubyonra...@googlegroups.com
On 28 August 2012 02:16, Dheeraj Kumar <a.dheer...@gmail.com> wrote:
LOL! All know its absurd, don't u ppl have a sense of humour or
something?

A serious suggestion: don't insult your clients with your choice of platform. -- H 
--
Sent from my mobile device
Envoyait de mon portable

Dheeraj Kumar

unread,
Aug 28, 2012, 9:43:35 AM8/28/12
to rubyonra...@googlegroups.com
Hey I didn't write that!


Dheeraj Kumar

--

Karthikeyan A k

unread,
Aug 28, 2012, 12:37:20 PM8/28/12
to rubyonra...@googlegroups.com
A joke book :-p

Michael Pavling wrote in post #1073542:

Karthikeyan A k

unread,
Aug 28, 2012, 12:39:58 PM8/28/12
to rubyonra...@googlegroups.com
Client?! Common, is Mac DRM free and Windows a free OS? This book is
under GFDL, if you don't like it, write your own by ripping it. Who
cares?

Hasan Diwan wrote in post #1073578:

selv...@gmail.com

unread,
Aug 28, 2012, 3:16:55 PM8/28/12
to rubyonra...@googlegroups.com
On Tue, Aug 28, 2012 at 10:09 PM, Karthikeyan A k <li...@ruby-forum.com> wrote:
> Client?! Common, is Mac DRM free and Windows a free OS? This book is
> under GFDL, if you don't like it, write your own by ripping it. Who
> cares?

Somebody please stop this guy. He's digging his own grave in a lot of
communities.

--
Azhagu Selvan

http://tamizhgeek.in

Rakesh Kumar

unread,
Aug 27, 2012, 7:44:20 AM8/27/12
to rubyonra...@googlegroups.com
Hey Thanks.

On Mon, Aug 27, 2012 at 5:10 PM, Balaraju Vankala <li...@ruby-forum.com> wrote:
Hey Thank you .... i downloaded it just now.

Karthikeyan A k

unread,
Aug 29, 2012, 7:37:32 AM8/29/12
to rubyonra...@googlegroups.com
Well I can't dig it if I am dead, hence doing it now. :-))

selv...@gmail.com wrote in post #1073635:

selv...@gmail.com

unread,
Aug 29, 2012, 9:06:13 AM8/29/12
to rubyonra...@googlegroups.com
All the best :)
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



Anton Cherepanov

unread,
Aug 29, 2012, 9:54:40 AM8/29/12
to rubyonra...@googlegroups.com
There is not enough space in 29 page
Fine, if 1 is not equal to 2 to a computer when we type it, it must
putout true, so type it in your

Word - putout :)

INDIAN RAILS DEVELOPER

unread,
Aug 29, 2012, 1:50:50 PM8/29/12
to rubyonra...@googlegroups.com
It seems like you are looking for editor,honestly speaking vim with rails and snipmate plugin is great. You may never look to some other editor. Only some initial learning curve is required .
After then you will fly like superman and you feel proud to being so productive . I saw many job positions, and everyone is prefering vim editor . You can visit the factory_girl gem company homepage(one of the best rails developer in boston ) also use vim

Bruce Whealton

unread,
Sep 1, 2012, 1:06:57 AM9/1/12
to rubyonra...@googlegroups.com
Colin,
    You had referred me to this link:
I thought it would be a good idea to learn this in a linux environment.  My apps on the web will be in Linux.  I setup a virtualbox for Windows and installed Ubuntu Server 12.04.  This part I did separately as I was learning Linux for web development. 
I got all the way down to starting the WEBrick server, with everything looking good and it said that it is running on port 3000.  And I should be able to browse to http://localhost:3000
and I get “Unable to Connect”
 
which was shown in the terminal window.
 
Since, I currently only have the server and not the gui for Linux Ubuntu, I thought I should be able to see this from my host operating system, Windows. 
Also, when I installed phpmyadmin, the instructor said that we should be able to get there using http://localhost:8080/phpmyadmin/
If I leave off the phpmyadmin, the page that comes up shows that the server is running and I get a message that just says “It works” – a bit of code to show that things are working. 
The instructor has us install this in the folder /etc/phpadmin
but when we installed Symfony, we were supposed to use folder /media/sf_sandbox/ 
I tried to get to that folder and was told I didn’t have permission.  I couldn’t use sudo cd as that just said that cd is not recognized. 
 
So, I obviously have rvm, ruby and gems installed but nothing beyond that is working in the way of getting a ruby on rails test app running.
Thanks in advance for any help,
Bruce

Colin

Colin Law

unread,
Sep 1, 2012, 3:09:25 AM9/1/12
to rubyonra...@googlegroups.com
On 1 September 2012 06:06, Bruce Whealton <br...@whealton.info> wrote:
> Colin,
> You had referred me to this link:
> For installing
> in ubuntu then
> http://blog.sudobits.com/2012/05/02/how-to-install-ruby-on-rails-in-ubuntu-12-04-lts/
> is pretty good..
>>>>
> I thought it would be a good idea to learn this in a linux environment. My
> apps on the web will be in Linux. I setup a virtualbox for Windows and
> installed Ubuntu Server 12.04. This part I did separately as I was learning
> Linux for web development.
> I got all the way down to starting the WEBrick server, with everything
> looking good and it said that it is running on port 3000. And I should be
> able to browse to http://localhost:3000
> and I get “Unable to Connect”
> I tried http://localhost:3000, http://0.0.0.0:3000
> also http://sandbox.dev:3000
>
> which was shown in the terminal window.

In at terminal in your VM try
wget http://localhost:3000
if that succeeds then the server is running ok and is accessible from
within the VM. The problem then is how to access the server in the VM
from Windows. Sorry but I know nothing about VirtualBox so can't help
there. Possibly a VirtualBox list would be a better place to ask.
Perhaps you can install a GUI into the VM so you can run the browser
there, or alternatively install a version of Linux with a GUI as a new
VM and run the app there.

>
> Since, I currently only have the server and not the gui for Linux Ubuntu, I
> thought I should be able to see this from my host operating system, Windows.
> Also, when I installed phpmyadmin, the instructor said that we should be
> able to get there using http://localhost:8080/phpmyadmin/
> If I leave off the phpmyadmin, the page that comes up shows that the server
> is running and I get a message that just says “It works” – a bit of code to
> show that things are working.
> The instructor has us install this in the folder /etc/phpadmin
> but when we installed Symfony, we were supposed to use folder
> /media/sf_sandbox/
> I tried to get to that folder and was told I didn’t have permission. I
> couldn’t use sudo cd as that just said that cd is not recognized.

Sorry no idea about any of this, again it does not appear to be to do
with Rails.

>
> So, I obviously have rvm, ruby and gems installed but nothing beyond that is
> working in the way of getting a ruby on rails test app running.

My guess is that the app is running fine, it is just that you cannot
see it from Windows.

Colin

Bruce Whealton

unread,
Sep 2, 2012, 1:49:17 AM9/2/12
to rubyonra...@googlegroups.com
Dheeraj,
       And others...  I am now convinced to use Linux/Ubuntu in my VirtualBox installation.  I followed the tutorial that was posted earlier.  Colin, on this list, recommended this posting:
I’ll have to lookup that link and try to find it again.  I did everything in the tutorial, got all the way to the bottom... where it says “Now you can see your installation of test_app and there is a smiley face.  I try that very last step, where everything above it worked fine and so I go to my browser, enter http;//localhost:3000
There might have been a directory, I’ll have to dig up that tutorial link.  Whatever it said for where to go in the browser is where I went.  It says “Cannot display page...”
Not found... etc. 
       Now in the course I took online at Lynda.com, called “Up and Running with Linux for PHP Developers.”  The location where we would be installing software is giving me an error saying I don’t have permission to use that directory.  It is /media/sf_sandbox/
I did try the sudo command in front of cd to go to that directory and it said it didn’t recognize sudo cd.  It is both embarrassing and very frustrating that it continues to take me so long to get this working.  After all this time, I STILL don’t have a rails install that I can browse to.  I’ve never ever had this kind of problem with anything, any programming language or language environment. 
Thanks,

Dheeraj Kumar

unread,
Sep 2, 2012, 2:39:16 AM9/2/12
to rubyonra...@googlegroups.com
Are you sure you ran `rails server` before navigating to localhost:3000 ? did it throw any errors?



Dheeraj Kumar

Colin Law

unread,
Sep 2, 2012, 4:04:22 AM9/2/12
to rubyonra...@googlegroups.com
On 2 September 2012 06:49, Bruce Whealton <br...@whealton.info> wrote:
> Dheeraj,
> And others... I am now convinced to use Linux/Ubuntu in my
> VirtualBox installation. I followed the tutorial that was posted earlier.
> Colin, on this list, recommended this posting:
> http://blog.sudobits.com/2012/05/02/how-to-install-ruby-on-rails-in-ubuntu-12-04-lts/
> I’ll have to lookup that link and try to find it again. I did everything in
> the tutorial, got all the way to the bottom... where it says “Now you can
> see your installation of test_app and there is a smiley face. I try that
> very last step, where everything above it worked fine and so I go to my
> browser, enter http;//localhost:3000
> There might have been a directory, I’ll have to dig up that tutorial link.
> Whatever it said for where to go in the browser is where I went. It says
> “Cannot display page...”
> Not found... etc.

Why have you just posted this question again? Did you see the
suggestions in my last post?

> Now in the course I took online at Lynda.com, called “Up and Running
> with Linux for PHP Developers.” The location where we would be installing
> software is giving me an error saying I don’t have permission to use that
> directory. It is /media/sf_sandbox/
> I did try the sudo command in front of cd to go to that directory and it
> said it didn’t recognize sudo cd. It is both embarrassing and very
> frustrating that it continues to take me so long to get this working. After
> all this time, I STILL don’t have a rails install that I can browse to.
> I’ve never ever had this kind of problem with anything, any programming
> language or language environment.

I don't think this is the right place to ask for help with installing
php on linux. It does not seem to have much to do with Rails.

Colin

Bruce Whealton

unread,
Sep 2, 2012, 7:00:43 AM9/2/12
to rubyonra...@googlegroups.com
I meant no offense. Please, don't take it that way. Let me explain my
post... I had originally intended to use Windows as the environment
for running Ruby on Rails, as a course I was following used both Windows and
Mac. I finally felt convinced that it would be just as well to use
Linux. I had respectfully asked if I could share my experience in trying
this.

I'm just very frustrated as I'm sure anyone can understand. This should not
be so difficult to get up and running. I finally did get Ruby on Rails in
stalled correct (or almost correctly)
and installed a test_app. Then when I tried to create an application with
mysql database, it failed. Some other folks seemed to report some similar
problems which I discovered when I did a web search. Unfortunately, the
solutions were lacking in the articles and stack overflow posts that I read.

The use of Linux was a key part of the issue as it was suggested as a
solution to the problem of not being able to install Ruby when I was using
Windows.

Anyway, I keep going in circles. I get a message saying that I need to
install gem msyql2 which I do and it reports back with no error and so I try
again to install the app with the rails command and I get the same error.
Thanks in advance for your help and time,
Bruce

-----Original Message-----
From: Colin Law
Sent: Sunday, September 2, 2012 4:04 AM
To: rubyonra...@googlegroups.com
Subject: Re: [Rails] Help getting started: Newbie: Windows and Rails

On 2 September 2012 06:49, Bruce Whealton <br...@whealton.info> wrote:
> Dheeraj,
> And others... I am now convinced to use Linux/Ubuntu in my
> VirtualBox installation. I followed the tutorial that was posted earlier.
> Colin, on this list, recommended this posting:
> http://blog.sudobits.com/2012/05/02/how-to-install-ruby-on-rails-in-ubuntu-12-04-lts/
> I�ll have to lookup that link and try to find it again. I did everything
> in
> the tutorial, got all the way to the bottom... where it says �Now you can
> see your installation of test_app and there is a smiley face. I try that
> very last step, where everything above it worked fine and so I go to my
> browser, enter http;//localhost:3000
> There might have been a directory, I�ll have to dig up that tutorial link.
> Whatever it said for where to go in the browser is where I went. It says
> �Cannot display page...�
> Not found... etc.

Why have you just posted this question again? Did you see the
suggestions in my last post?

> Now in the course I took online at Lynda.com, called �Up and
> Running
> with Linux for PHP Developers.� The location where we would be installing
> software is giving me an error saying I don�t have permission to use that
> directory. It is /media/sf_sandbox/
> I did try the sudo command in front of cd to go to that directory and it
> said it didn�t recognize sudo cd. It is both embarrassing and very
> frustrating that it continues to take me so long to get this working.
> After
> all this time, I STILL don�t have a rails install that I can browse to.
> I�ve never ever had this kind of problem with anything, any programming
> language or language environment.

I don't think this is the right place to ask for help with installing
php on linux. It does not seem to have much to do with Rails.

Colin

Dheeraj Kumar

unread,
Sep 2, 2012, 7:28:39 AM9/2/12
to rubyonra...@googlegroups.com
You need to add it to the gemfile and run the bundle command.


Dheeraj Kumar

I’ll have to lookup that link and try to find it again. I did everything
in
the tutorial, got all the way to the bottom... where it says “Now you can
see your installation of test_app and there is a smiley face. I try that
very last step, where everything above it worked fine and so I go to my
browser, enter http;//localhost:3000
There might have been a directory, I’ll have to dig up that tutorial link.
Whatever it said for where to go in the browser is where I went. It says
“Cannot display page...”
Not found... etc.

Why have you just posted this question again? Did you see the
suggestions in my last post?

Now in the course I took online at Lynda.com, called “Up and
Running
with Linux for PHP Developers.” The location where we would be installing
software is giving me an error saying I don’t have permission to use that
directory. It is /media/sf_sandbox/
I did try the sudo command in front of cd to go to that directory and it
said it didn’t recognize sudo cd. It is both embarrassing and very
frustrating that it continues to take me so long to get this working.
After
all this time, I STILL don’t have a rails install that I can browse to.
I’ve never ever had this kind of problem with anything, any programming
language or language environment.

Bill Walton

unread,
Sep 2, 2012, 7:29:37 AM9/2/12
to rubyonra...@googlegroups.com
Hi Bruce,

On Sun, Sep 2, 2012 at 6:00 AM, Bruce Whealton <br...@whealton.info> wrote:
<snip>

 
Anyway, I keep going in circles.  I get a message saying that I need to install gem msyql2 which I do and it reports back with no error and so I try again to install the app with the rails command and I get the same error.


I took a quick look at that tutorial, and if that's all you did you should be getting the index.html file that Rails installs (the tutorial left out the part where it tells you that you have to delete it).  If you did that, then you're into the app itself and your problem description doesn't say much about what you did in addition to the tutorial.


So.... need a little more info.  How are you installing the mysql2 gem?  Are you using Bundler?  Is the gem specified in the Gemfile?   Were you able to rake db:migrate or is that where you're having your problem?

Best regards,
Bill

Bruce Whealton

unread,
Sep 2, 2012, 12:53:42 PM9/2/12
to rubyonra...@googlegroups.com
Bill,
        First, I really appreciate your help.  At the risk of sounding naïve, in response to Dheeraj’s post that  “You need to add it to the gemfile and run the bundle command.”  How do I do that?  I guess this is where I need to be more specific about where I left off.  Ok, the tutorial that I mentioned here: http://blog.sudobits.com/2012/05/02/how-to-install-ruby-on-rails-in-ubuntu-12-04-lts/
uses the Webrick server.  For some reason, when I started that server and then tried to view the page using port 3000, it did not connect.  Therefore, I had my VirtualBox setup with Ubuntu and using Apache2 on port 8080, which I could get to from my host OS.  I wasn’t seeing that test app described at the above link, until I went into the folder http://localhost:8080/test_app/
     Of course, now, for some reason, I cannot get into any of the apps that I just installed hours ago.  I get Not Found at the test_app link that I included just above.  I can go to the http://localhost:8080/ uri and see some web content that was put there.  However, the test_app that worked fine just a little while ago, is not working now.  Had it been working I would have said that the last problem to address is creating an application with mysql support. 
      It is frustrating that my problem is now apparently related to my Linux installation on my system and I cannot address the other issues of moving on to learning RoR. 
1) test_app from the tutorial: http://blog.sudobits.com/2012/05/02/how-to-install-ruby-on-rails-in-ubuntu-12-04-lts/ **was** working fine with apache2, not with Webrick.  Unlike in that tutorial, I couldn’t go to just http://localhost:8080 or localhost:3000, I had to add the directory in my browsers address bar, then I think I had to go into public. 
2)  How are you installing the mysql2 gem?  Are you using Bundler?  In the above referenced tutorial, I didn’t need mysql.  However, when I added that to the command line:
rails new simple_cms –d mysql
I got the message: “An error occurred while installing mysql2 (0.3.11), and Bundler cannot continue.  Make sure that ‘gem install mysqsl2 –v ‘0.3.11’` succeeds before bundling.  So, I then enter
gem install mysql2 –v ‘0.3.11’
Then I try my install again... when asked to continue and over-write, I say Y.  Then I get the same error.
What is curious is that if I include the ` after the gem install mysql –v ‘0.3.11’ it gives me a different prompt. 
3) Is the gem specified in the Gemfile?   Were you able to rake db:migrate or is that where you're having your problem?
I don’t know what the latter means.  I can look at the Gemfile and it has this in it:
source :rubygems
 
gemspec
 
I know it is somewhat off topic, but I have to somehow figure out why the apps I created previously, php and the RoR app (without the msyql support) are not now accessible from a browser. 
Thanks,
Bruce

 

 
 
Sent: Sunday, September 2, 2012 7:29 AM
Subject: Re: [Rails] Help getting started: Newbie: Windows and Rails
 

Walter Lee Davis

unread,
Sep 2, 2012, 1:06:22 PM9/2/12
to rubyonra...@googlegroups.com

On Sep 2, 2012, at 12:53 PM, Bruce Whealton wrote:

> Bill,
> First, I really appreciate your help. At the risk of sounding naïve, in response to Dheeraj’s post that “You need to add it to the gemfile and run the bundle command.” How do I do that? I guess this is where I need to be more specific about where I left off. Ok, the tutorial that I mentioned here: http://blog.sudobits.com/2012/05/02/how-to-install-ruby-on-rails-in-ubuntu-12-04-lts/
> uses the Webrick server. For some reason, when I started that server and then tried to view the page using port 3000, it did not connect.

Were you trying to connect from within your virtualbox environment, or from the host OS? Try looking at your Webrick-hosted sites from the same OS that you launched them under -- that's the normal use-case for those sorts of self-hosted apps. It's meant to be a window into your dev site, just a quick-and-dirty hack to get you to a click-test of the app.

> Therefore, I had my VirtualBox setup with Ubuntu and using Apache2 on port 8080, which I could get to from my host OS. I wasn’t seeing that test app described at the above link, until I went into the folder http://localhost:8080/test_app/
> Of course, now, for some reason, I cannot get into any of the apps that I just installed hours ago. I get Not Found at the test_app link that I included just above. I can go to the http://localhost:8080/ uri and see some web content that was put there. However, the test_app that worked fine just a little while ago, is not working now. Had it been working I would have said that the last problem to address is creating an application with mysql support.

Not sure what this all means, but I would still try to see the site from within the linux environment, if that's where it is running (that is, if it was started with `rails server` from within the folder in a terminal).

If you have Apache running inside virtualbox, and you can see a test site (the classic It Works! page) at :8080 from your host OS, then you need to set up passenger inside Linux, configure each virtual host where you want to run Rails, and it should just work. Passenger on Linux is a very patient and instructive installer script, so much so that I have not yet failed to get it running on a bare VPS, despite my home-school approach to Linux admin.

> It is frustrating that my problem is now apparently related to my Linux installation on my system and I cannot address the other issues of moving on to learning RoR.
> 1) test_app from the tutorial: http://blog.sudobits.com/2012/05/02/how-to-install-ruby-on-rails-in-ubuntu-12-04-lts/ **was** working fine with apache2, not with Webrick. Unlike in that tutorial, I couldn’t go to just http://localhost:8080 or localhost:3000, I had to add the directory in my browsers address bar, then I think I had to go into public.
> 2) How are you installing the mysql2 gem? Are you using Bundler? In the above referenced tutorial, I didn’t need mysql. However, when I added that to the command line:
> rails new simple_cms –d mysql
> I got the message: “An error occurred while installing mysql2 (0.3.11), and Bundler cannot continue. Make sure that ‘gem install mysqsl2 –v ‘0.3.11’` succeeds before bundling. So, I then enter
> gem install mysql2 –v ‘0.3.11’
> Then I try my install again... when asked to continue and over-write, I say Y. Then I get the same error.
> What is curious is that if I include the ` after the gem install mysql –v ‘0.3.11’ it gives me a different prompt.
> 3) Is the gem specified in the Gemfile? Were you able to rake db:migrate or is that where you're having your problem?
> I don’t know what the latter means. I can look at the Gemfile and it has this in it:
> source :rubygems
>
> gemspec

Your gemfile should have quite a bit more than that inside it, at least on a bare Rails app. Here's one now:

source 'https://rubygems.org'

gem 'rails', '3.2.7'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'


# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby

gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'

IF that file exists at the base of your rails root, and you cd into that folder and type bundle install, you should see a lot of terminal whizz by, and your app should suddenly have everything it needs to start up properly.
>
> I know it is somewhat off topic, but I have to somehow figure out why the apps I created previously, php and the RoR app (without the msyql support) are not now accessible from a browser.

You've probably borked your Apache install somewhat. See if you can get to a bare virtual host, just a folder with index.html in it. IF that works, then go up a level and make sure that passenger is properly installed, and you've configured a new virtual host for your Rails app. Don't try to share a vhost with another app.

Walter

Dheeraj Kumar

unread,
Sep 2, 2012, 1:08:29 PM9/2/12
to rubyonra...@googlegroups.com
No offense, but I suggest you ditch the Lynda tutorial. If it doesn't mention a gem file or a bundle command, that's not a good sign.

The best (and only) guide to every beginner to Ruby on Rails is a book, called Agile Web Development with Rails. You can find it here: http://pragprog.com/book/rails4/agile-web-development-with-rails 


Dheeraj Kumar

Bruce Whealton

unread,
Sep 2, 2012, 1:50:40 PM9/2/12
to rubyonra...@googlegroups.com
I'll comment below.

On Sep 2, 2012, at 12:53 PM, Bruce Whealton wrote:

> Bill,
> First, I really appreciate your help. At the risk of sounding
> na�ve, in response to Dheeraj�s post that �You need to add it to the
> gemfile and run the bundle command.� How do I do that? I guess this is
> where I need to be more specific about where I left off. Ok, the tutorial
> that I mentioned here:
> http://blog.sudobits.com/2012/05/02/how-to-install-ruby-on-rails-in-ubuntu-12-04-lts/
> uses the Webrick server. For some reason, when I started that server and
> then tried to view the page using port 3000, it did not connect.

Were you trying to connect from within your virtualbox environment, or from
the host OS? Try looking at your Webrick-hosted sites from the same OS that
you launched them under -- that's the normal use-case for those sorts of
self-hosted apps. It's meant to be a window into your dev site, just a
quick-and-dirty hack to get you to a click-test of the app.
>>>
Yes, I was trying from the host OS. I do have KDE installed in Linux so I
can browse to the Webrick link.

> Therefore, I had my VirtualBox setup with Ubuntu and using Apache2 on port
> 8080, which I could get to from my host OS. I wasn�t seeing that test app
> described at the above link, until I went into the folder
> http://localhost:8080/test_app/
> Of course, now, for some reason, I cannot get into any of the apps
> that I just installed hours ago. I get Not Found at the test_app link
> that I included just above. I can go to the http://localhost:8080/ uri
> and see some web content that was put there. However, the test_app that
> worked fine just a little while ago, is not working now. Had it been
> working I would have said that the last problem to address is creating an
> application with mysql support.

Not sure what this all means, but I would still try to see the site from
within the linux environment, if that's where it is running (that is, if it
was started with `rails server` from within the folder in a terminal).
>>>
I wonder why I cannot get an app created in RoR with support for mysql?

If you have Apache running inside virtualbox, and you can see a test site
(the classic It Works! page) at :8080 from your host OS, then you need to
set up passenger inside Linux, configure each virtual host where you want to
run Rails, and it should just work. Passenger on Linux is a very patient and
instructive installer script, so much so that I have not yet failed to get
it running on a bare VPS, despite my home-school approach to Linux admin.
>>>>
Can you expand on this? What will Passenger do?

> It is frustrating that my problem is now apparently related to my
> Linux installation on my system and I cannot address the other issues of
> moving on to learning RoR.
> 1) test_app from the tutorial:
> http://blog.sudobits.com/2012/05/02/how-to-install-ruby-on-rails-in-ubuntu-12-04-lts/
> **was** working fine with apache2, not with Webrick. Unlike in that
> tutorial, I couldn�t go to just http://localhost:8080 or localhost:3000, I
> had to add the directory in my browsers address bar, then I think I had to
> go into public.
> 2) How are you installing the mysql2 gem? Are you using Bundler? In the
> above referenced tutorial, I didn�t need mysql. However, when I added
> that to the command line:
> rails new simple_cms �d mysql
> I got the message: �An error occurred while installing mysql2 (0.3.11),
> and Bundler cannot continue. Make sure that �gem install mysqsl2 �v
> �0.3.11�` succeeds before bundling. So, I then enter
> gem install mysql2 �v �0.3.11�
> Then I try my install again... when asked to continue and over-write, I
> say Y. Then I get the same error.
> What is curious is that if I include the ` after the gem install mysql �v
> �0.3.11� it gives me a different prompt.
> 3) Is the gem specified in the Gemfile? Were you able to rake db:migrate
> or is that where you're having your problem?
> I don�t know what the latter means. I can look at the Gemfile and it has
How do I get a Gemfile that is like that? My installation process didn't
seem to work.
>
> I know it is somewhat off topic, but I have to somehow figure out why the
> apps I created previously, php and the RoR app (without the msyql support)
> are not now accessible from a browser.

You've probably borked your Apache install somewhat. See if you can get to a
bare virtual host, just a folder with index.html in it. IF that works, then
go up a level and make sure that passenger is properly installed, and you've
configured a new virtual host for your Rails app. Don't try to share a vhost
with another app.
>>>
I need to learn more. Like how to get a bare virtual host... do you mean
reinstall apache somehow? Create a new install of Ubuntu in the VirtualBox?
I do have root access to a dedicated server but it uses CentOS and so that
is different and I'm only just now learning Linux.
Thanks,
Bruce

Walter Lee Davis

unread,
Sep 2, 2012, 2:18:21 PM9/2/12
to rubyonra...@googlegroups.com

On Sep 2, 2012, at 1:50 PM, Bruce Whealton wrote:

> I'll comment below.
>
> On Sep 2, 2012, at 12:53 PM, Bruce Whealton wrote:
>
>> Bill,
>> First, I really appreciate your help. At the risk of sounding naïve, in response to Dheeraj’s post that “You need to add it to the gemfile and run the bundle command.” How do I do that? I guess this is where I need to be more specific about where I left off. Ok, the tutorial that I mentioned here: http://blog.sudobits.com/2012/05/02/how-to-install-ruby-on-rails-in-ubuntu-12-04-lts/
>> uses the Webrick server. For some reason, when I started that server and then tried to view the page using port 3000, it did not connect.
>
> Were you trying to connect from within your virtualbox environment, or from the host OS? Try looking at your Webrick-hosted sites from the same OS that you launched them under -- that's the normal use-case for those sorts of self-hosted apps. It's meant to be a window into your dev site, just a quick-and-dirty hack to get you to a click-test of the app.
>>>>
> Yes, I was trying from the host OS. I do have KDE installed in Linux so I can browse to the Webrick link.
>
>> Therefore, I had my VirtualBox setup with Ubuntu and using Apache2 on port 8080, which I could get to from my host OS. I wasn’t seeing that test app described at the above link, until I went into the folder http://localhost:8080/test_app/
>> Of course, now, for some reason, I cannot get into any of the apps that I just installed hours ago. I get Not Found at the test_app link that I included just above. I can go to the http://localhost:8080/ uri and see some web content that was put there. However, the test_app that worked fine just a little while ago, is not working now. Had it been working I would have said that the last problem to address is creating an application with mysql support.
>
> Not sure what this all means, but I would still try to see the site from within the linux environment, if that's where it is running (that is, if it was started with `rails server` from within the folder in a terminal).
>>>>
> I wonder why I cannot get an app created in RoR with support for mysql?

Please copy and paste the exact rails new … command you typed into terminal when you created your test app.

There are tons of flags you can use to set up rails with various databases. By default, it will use SQLite3, because that just works most places. If you pass -d mysql to the new command, you will get a mysql connector. But note that you don't have to do this at the beginning of your project. You can create a default (SQLite) application, then transfer it to MySQL or PostgreSQL or anything else that's supported, later in the project life-cycle by changing a few lines of your gemfile and database.yml files.

>
> If you have Apache running inside virtualbox, and you can see a test site (the classic It Works! page) at :8080 from your host OS, then you need to set up passenger inside Linux, configure each virtual host where you want to run Rails, and it should just work. Passenger on Linux is a very patient and instructive installer script, so much so that I have not yet failed to get it running on a bare VPS, despite my home-school approach to Linux admin.
>>>>>
> Can you expand on this? What will Passenger do?

Passenger is one of the ways to serve Rails applications. Think of it as mod_php but for Rails. It's an Apache module that understands the structure of a Rails application and how to pass Web requests from Apache into Rails. Learn more at http://modrails.org

>
>> It is frustrating that my problem is now apparently related to my Linux installation on my system and I cannot address the other issues of moving on to learning RoR.

I would take the patient advice of many others on this list, and please put down the Lynda tutorial. Pick up the http://railstutorial.org path instead. This is a FREE course that teaches you how to go from nothing to a working, tested Rails app hosted on Heroku (which is also free) and will give you the leg up you need without immersing you in the minutia of installation hell where you seem to be circling. You will still want to get a working local install of Rails, which will include being able to browse your test site (hosted out of Webrick) locally at http://localhost:3000 But that is really not as hard as your combination of aged tutorial and lack of experience in Linux is giving you. There are even instructions in railstutorial that will show you how to get Rails installed directly under Windows, although I would urge you to charge on and get it to work in your Linux environment instead.

>> 1) test_app from the tutorial: http://blog.sudobits.com/2012/05/02/how-to-install-ruby-on-rails-in-ubuntu-12-04-lts/ **was** working fine with apache2, not with Webrick. Unlike in that tutorial, I couldn’t go to just http://localhost:8080 or localhost:3000, I had to add the directory in my browsers address bar, then I think I had to go into public.
>> 2) How are you installing the mysql2 gem? Are you using Bundler? In the above referenced tutorial, I didn’t need mysql. However, when I added that to the command line:
>> rails new simple_cms –d mysql
>> I got the message: “An error occurred while installing mysql2 (0.3.11), and Bundler cannot continue. Make sure that ‘gem install mysqsl2 –v ‘0.3.11’` succeeds before bundling. So, I then enter
>> gem install mysql2 –v ‘0.3.11’
>> Then I try my install again... when asked to continue and over-write, I say Y. Then I get the same error.
>> What is curious is that if I include the ` after the gem install mysql –v ‘0.3.11’ it gives me a different prompt.
>> 3) Is the gem specified in the Gemfile? Were you able to rake db:migrate or is that where you're having your problem?
>> I don’t know what the latter means. I can look at the Gemfile and it has this in it:
Again. Please post the rails new command that you typed (at its most basic, this will be `rails new mynewapp` and it will be followed by a bunch of feedback from the rails command, culminating in a working Rails app). Also post the output of rails -v in your terminal.

>>
>> I know it is somewhat off topic, but I have to somehow figure out why the apps I created previously, php and the RoR app (without the msyql support) are not now accessible from a browser.
>
> You've probably borked your Apache install somewhat. See if you can get to a bare virtual host, just a folder with index.html in it. IF that works, then go up a level and make sure that passenger is properly installed, and you've configured a new virtual host for your Rails app. Don't try to share a vhost with another app.
>>>>
> I need to learn more. Like how to get a bare virtual host... do you mean reinstall apache somehow? Create a new install of Ubuntu in the VirtualBox?
> I do have root access to a dedicated server but it uses CentOS and so that is different and I'm only just now learning Linux.

If you started with a distribution of Linux that included Apache already configured, you may have a working copy of Apache. Try launching Apache in your terminal:

sudo apachectl configtest
sudo apachectl start

(substitute apache2ctl if apachectl doesn't work -- depends on the distro)

If configtest doesn't report any errors, start may tell you Apache is already running. If not, it will start it. When Apache is running, then try going to http://localhost in your Linux browser, and see what you see there. You should see the default host, which in many Ubuntu versions is a white page with the words It Works! really big at the top.

If that works, then move on to installing Passenger, which will get you a connection between Apache and Rails. The Passenger installer will probably tell you to install a half-dozen packages, and it will tell you explicitly how to do this. Like I said, it's very patient.

Walter

Bruce Whealton

unread,
Sep 3, 2012, 8:14:54 PM9/3/12
to rubyonra...@googlegroups.com
Hello,
Thanks Walter for your suggestions and information. I definitely
follow advice. Here's some surprising news. I actually got everything
working right inside Windows while still trying to get things to work in
Linux!!! My Linux installation does not even have the mysql gem or the
mysql2 gem installed. I thought for sure I had it installed earlier.
Some of the issues of trying to get Rails working in Linux as
recommended deal with my ability to do simple things like capture the output
of any command to a file. This would greatly help me to answer some of your
questions about what is going wrong.
I did figure out some things about a rails app that change how I
might try to access a page. For example, if I launch Webrick, and then
navigate to http://localhost:3000/demo/index
I get my demo controller and index action. It is inside an app called
simple_cms, or it could be in demo_app. However, if I try to visit
http://localhost:3000/simple_cms/demo/index that doesn't work. I get a
"Routing Error" No route matches (GET) "simple_cms/demo/index
So, how does Rails know which application to run if you had many apps
installed? For example, I have a testing environment where I use xampp. I
thought I'd install my rails app there and just use apache which is already
installed on my system. And I have many websites/applications in the htdocs
folder. Therefore, if I wanted to setup a simple cms based on php, I'd
maybe put it in htdocs/simple_cms/ and then I would know that I need to
include the directory simple_cms so that Apache knows how to deliver pages,
with each folder being self-contained. With Rails, how would this work, I
have a folder where I put files, for example the htdocs folder (maybe I
shouldn't use that for the Rails apps to avoid confusion), my sites
directory. So, I might have inside the sites directory the following:
simple_cms
mysecond_app
mythird_app
and these would all be directories under the sites directory. How does Ruby
on Rails know which one to serve?

Ok, at the risk of going off topic and discussing Linux issues,
could I ask that you tell me how I might issue the commands you mention,
such as the rails new command such that the output can be sent to a file
that is easy to find. I currently use putty for Windows and haven't figured
out how to select content and copy it to the Windows clip board so that I
could then paste that to a text editor.
My problems are with regard to where I left off in my Linux
installation of Ruby on Rails, I couldn't get the gem mysql or gem mysql2 to
install. When I type in gem list, I don't see either of those.
I type in my linux sandbox:
rails new demo_app -d mysql
I get Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native
extension.
Below that, an error occurred while installing mysql2 (0.3.11) and Bundler
cannot continue. Make sure that 'gem install mysql2 -v '0.3.11'` succeeds
before bundling. At which point, I try to do
Sudo Gem install mysql2 and I get asked for my password and then it says the
command sudo gem isn't recognized. So, I try it without sudo and it fails
to install.
I did pick up that book that happens to be directly related to the
tutorial that you sent to me.
Thanks,
Bruce
-----Original Message-----
From: Walter Lee Davis
Sent: Sunday, September 2, 2012 2:18 PM
To: rubyonra...@googlegroups.com
Subject: Re: [Rails] Help getting started: Newbie: Windows and Rails


On Sep 2, 2012, at 1:50 PM, Bruce Whealton wrote:

> I'll comment below.
>
> On Sep 2, 2012, at 12:53 PM, Bruce Whealton wrote:
>
>> Bill,
>> First, I really appreciate your help. At the risk of sounding
>> na�ve, in response to Dheeraj�s post that �You need to add it to the
>> gemfile and run the bundle command.� How do I do that? I guess this is
>> where I need to be more specific about where I left off. Ok, the
>> tutorial that I mentioned here:
>> http://blog.sudobits.com/2012/05/02/how-to-install-ruby-on-rails-in-ubuntu-12-04-lts/
>> uses the Webrick server. For some reason, when I started that server and
>> then tried to view the page using port 3000, it did not connect.
>
> Were you trying to connect from within your virtualbox environment, or
> from the host OS? Try looking at your Webrick-hosted sites from the same
> OS that you launched them under -- that's the normal use-case for those
> sorts of self-hosted apps. It's meant to be a window into your dev site,
> just a quick-and-dirty hack to get you to a click-test of the app.
>>>>
> Yes, I was trying from the host OS. I do have KDE installed in Linux so I
> can browse to the Webrick link.
>
>> Therefore, I had my VirtualBox setup with Ubuntu and using Apache2 on
>> port 8080, which I could get to from my host OS. I wasn�t seeing that
>> test app described at the above link, until I went into the folder
>> http://localhost:8080/test_app/
>> Of course, now, for some reason, I cannot get into any of the apps
>> that I just installed hours ago. I get Not Found at the test_app link
>> that I included just above. I can go to the http://localhost:8080/ uri
>> and see some web content that was put there. However, the test_app that
>> worked fine just a little while ago, is not working now. Had it been
>> working I would have said that the last problem to address is creating an
>> application with mysql support.
>
> Not sure what this all means, but I would still try to see the site from
> within the linux environment, if that's where it is running (that is, if
> it was started with `rails server` from within the folder in a terminal).
>>>>
> I wonder why I cannot get an app created in RoR with support for mysql?

Please copy and paste the exact rails new � command you typed into terminal
>> tutorial, I couldn�t go to just http://localhost:8080 or localhost:3000,
>> I had to add the directory in my browsers address bar, then I think I had
>> to go into public.
>> 2) How are you installing the mysql2 gem? Are you using Bundler? In
>> the above referenced tutorial, I didn�t need mysql. However, when I
>> added that to the command line:
>> rails new simple_cms �d mysql
>> I got the message: �An error occurred while installing mysql2 (0.3.11),
>> and Bundler cannot continue. Make sure that �gem install mysqsl2 �v
>> �0.3.11�` succeeds before bundling. So, I then enter
>> gem install mysql2 �v �0.3.11�
>> Then I try my install again... when asked to continue and over-write, I
>> say Y. Then I get the same error.
>> What is curious is that if I include the ` after the gem install mysql �v
>> �0.3.11� it gives me a different prompt.
>> 3) Is the gem specified in the Gemfile? Were you able to rake
>> db:migrate or is that where you're having your problem?
>> I don�t know what the latter means. I can look at the Gemfile and it has

Walter Lee Davis

unread,
Sep 3, 2012, 8:38:10 PM9/3/12
to rubyonra...@googlegroups.com

On Sep 3, 2012, at 8:14 PM, Bruce Whealton wrote:

> Hello,
> Thanks Walter for your suggestions and information. I definitely follow advice. Here's some surprising news. I actually got everything working right inside Windows while still trying to get things to work in Linux!!! My Linux installation does not even have the mysql gem or the mysql2 gem installed. I thought for sure I had it installed earlier.
> Some of the issues of trying to get Rails working in Linux as recommended deal with my ability to do simple things like capture the output of any command to a file. This would greatly help me to answer some of your questions about what is going wrong.
> I did figure out some things about a rails app that change how I might try to access a page. For example, if I launch Webrick, and then navigate to http://localhost:3000/demo/index
> I get my demo controller and index action. It is inside an app called simple_cms, or it could be in demo_app. However, if I try to visit http://localhost:3000/simple_cms/demo/index that doesn't work. I get a "Routing Error" No route matches (GET) "simple_cms/demo/index

> So, how does Rails know which application to run if you had many apps installed? For example, I have a testing environment where I use xampp. I thought I'd install my rails app there and just use apache which is already installed on my system. And I have many websites/applications in the htdocs folder. Therefore, if I wanted to setup a simple cms based on php, I'd maybe put it in htdocs/simple_cms/ and then I would know that I need to include the directory simple_cms so that Apache knows how to deliver pages, with each folder being self-contained. With Rails, how would this work, I have a folder where I put files, for example the htdocs folder (maybe I shouldn't use that for the Rails apps to avoid confusion), my sites directory. So, I might have inside the sites directory the following:
> simple_cms
> mysecond_app
> mythird_app
> and these would all be directories under the sites directory. How does Ruby on Rails know which one to serve?

Only one Rails app can be running at a time on a single port. You can start one with rails s -p 3001 in one directory, and then cd into a different directory and use rails s, and you'll have two different Rails apps running at once on 3000 and 3001. You'll need to put the correct port into your browser to see each one, and this is kind of silly (unless you're experimenting with having one app talk to another, as in an oath server/client setup, say) but there you go, that's how it works. If you have Apache running, and passenger, and you've configured multiple virtual hosts, then you can access them on the same port just by setting up some sort of name resolution on your local box. Put the following in /etc/hosts:

127.0.0.1 one.app.dev
127.0.0.1 two.app.dev

and as long as you have configured your vhosts to have those names in Apache, you will be able to access those two made-up domain names on your local computer without entering any port number (they'll be running in port 80 -- the default).

>
> Ok, at the risk of going off topic and discussing Linux issues, could I ask that you tell me how I might issue the commands you mention, such as the rails new command such that the output can be sent to a file that is easy to find. I currently use putty for Windows and haven't figured out how to select content and copy it to the Windows clip board so that I could then paste that to a text editor.

Try using the Web interface to this list; either the Google Groups one, or the original at http://ruby-forum.com/forum/rails Then you can copy and paste from your terminal in Linux. I have only ever tried to use virtualbox on Mac OS X, where there is a menu command to move the clipboard from the guest to the host and vice-versa. You might also look into that option.

> My problems are with regard to where I left off in my Linux installation of Ruby on Rails, I couldn't get the gem mysql or gem mysql2 to install. When I type in gem list, I don't see either of those.
> I type in my linux sandbox:
> rails new demo_app -d mysql
> I get Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
> Below that, an error occurred while installing mysql2 (0.3.11) and Bundler cannot continue. Make sure that 'gem install mysql2 -v '0.3.11'` succeeds before bundling. At which point, I try to do
> Sudo Gem install mysql2 and I get asked for my password and then it says the command sudo gem isn't recognized. So, I try it without sudo and it fails to install.

You may need to back up quite a bit. Make sure that rubygems is installed, and the way you do that is with the command gem env in a terminal. If you don't get a nice listing of your Ruby and Rubygems environment, then start your googling. Don't use a package to install rubygems, use the source!

Once you have rubygems working, then find a package for the mysql-dev package, which will have all the headers you need to install the mysql2 gem. You didn't paste the entire error message, but I'm betting you don't have the source code on your system that the rubygems environment needs to build that gem. There are two parts to it (and some other gems as well) -- the ruby part, which is platform-agnostic, and the native C bindings, which have to be compiled for your hardware. Without the source code for MySQL, you won't be able to build the latter part.

> I did pick up that book that happens to be directly related to the tutorial that you sent to me.
> Thanks,
> Bruce

Hope this helps, and hope you get things going and begin to understand how it all works.

Walter

> -----Original Message----- From: Walter Lee Davis
> Sent: Sunday, September 2, 2012 2:18 PM
> To: rubyonra...@googlegroups.com
> Subject: Re: [Rails] Help getting started: Newbie: Windows and Rails
>
>
> On Sep 2, 2012, at 1:50 PM, Bruce Whealton wrote:
>
>> I'll comment below.
>>
>> On Sep 2, 2012, at 12:53 PM, Bruce Whealton wrote:
>>
>>> Bill,
>>> First, I really appreciate your help. At the risk of sounding naïve, in response to Dheeraj’s post that “You need to add it to the gemfile and run the bundle command.” How do I do that? I guess this is where I need to be more specific about where I left off. Ok, the tutorial that I mentioned here: http://blog.sudobits.com/2012/05/02/how-to-install-ruby-on-rails-in-ubuntu-12-04-lts/
>>> uses the Webrick server. For some reason, when I started that server and then tried to view the page using port 3000, it did not connect.
>>
>> Were you trying to connect from within your virtualbox environment, or from the host OS? Try looking at your Webrick-hosted sites from the same OS that you launched them under -- that's the normal use-case for those sorts of self-hosted apps. It's meant to be a window into your dev site, just a quick-and-dirty hack to get you to a click-test of the app.
>>>>>
>> Yes, I was trying from the host OS. I do have KDE installed in Linux so I can browse to the Webrick link.
>>
>>> Therefore, I had my VirtualBox setup with Ubuntu and using Apache2 on port 8080, which I could get to from my host OS. I wasn’t seeing that test app described at the above link, until I went into the folder http://localhost:8080/test_app/
>>> Of course, now, for some reason, I cannot get into any of the apps that I just installed hours ago. I get Not Found at the test_app link that I included just above. I can go to the http://localhost:8080/ uri and see some web content that was put there. However, the test_app that worked fine just a little while ago, is not working now. Had it been working I would have said that the last problem to address is creating an application with mysql support.
>>
>> Not sure what this all means, but I would still try to see the site from within the linux environment, if that's where it is running (that is, if it was started with `rails server` from within the folder in a terminal).
>>>>>
>> I wonder why I cannot get an app created in RoR with support for mysql?
>
> Please copy and paste the exact rails new … command you typed into terminal when you created your test app.
>
> There are tons of flags you can use to set up rails with various databases. By default, it will use SQLite3, because that just works most places. If you pass -d mysql to the new command, you will get a mysql connector. But note that you don't have to do this at the beginning of your project. You can create a default (SQLite) application, then transfer it to MySQL or PostgreSQL or anything else that's supported, later in the project life-cycle by changing a few lines of your gemfile and database.yml files.
>
>>
>> If you have Apache running inside virtualbox, and you can see a test site (the classic It Works! page) at :8080 from your host OS, then you need to set up passenger inside Linux, configure each virtual host where you want to run Rails, and it should just work. Passenger on Linux is a very patient and instructive installer script, so much so that I have not yet failed to get it running on a bare VPS, despite my home-school approach to Linux admin.
>>>>>>
>> Can you expand on this? What will Passenger do?
>
> Passenger is one of the ways to serve Rails applications. Think of it as mod_php but for Rails. It's an Apache module that understands the structure of a Rails application and how to pass Web requests from Apache into Rails. Learn more at http://modrails.org
>
>>
>>> It is frustrating that my problem is now apparently related to my Linux installation on my system and I cannot address the other issues of moving on to learning RoR.
>
> I would take the patient advice of many others on this list, and please put down the Lynda tutorial. Pick up the http://railstutorial.org path instead. This is a FREE course that teaches you how to go from nothing to a working, tested Rails app hosted on Heroku (which is also free) and will give you the leg up you need without immersing you in the minutia of installation hell where you seem to be circling. You will still want to get a working local install of Rails, which will include being able to browse your test site (hosted out of Webrick) locally at http://localhost:3000 But that is really not as hard as your combination of aged tutorial and lack of experience in Linux is giving you. There are even instructions in railstutorial that will show you how to get Rails installed directly under Windows, although I would urge you to charge on and get it to work in your Linux environment instead.
>
>>> 1) test_app from the tutorial: http://blog.sudobits.com/2012/05/02/how-to-install-ruby-on-rails-in-ubuntu-12-04-lts/ **was** working fine with apache2, not with Webrick. Unlike in that tutorial, I couldn’t go to just http://localhost:8080 or localhost:3000, I had to add the directory in my browsers address bar, then I think I had to go into public.
>>> 2) How are you installing the mysql2 gem? Are you using Bundler? In the above referenced tutorial, I didn’t need mysql. However, when I added that to the command line:
>>> rails new simple_cms –d mysql
>>> I got the message: “An error occurred while installing mysql2 (0.3.11), and Bundler cannot continue. Make sure that ‘gem install mysqsl2 –v ‘0.3.11’` succeeds before bundling. So, I then enter
>>> gem install mysql2 –v ‘0.3.11’
>>> Then I try my install again... when asked to continue and over-write, I say Y. Then I get the same error.
>>> What is curious is that if I include the ` after the gem install mysql –v ‘0.3.11’ it gives me a different prompt.
>>> 3) Is the gem specified in the Gemfile? Were you able to rake db:migrate or is that where you're having your problem?
>>> I don’t know what the latter means. I can look at the Gemfile and it has this in it:

Colin Law

unread,
Sep 4, 2012, 2:21:27 AM9/4/12
to rubyonra...@googlegroups.com
On 4 September 2012 01:14, Bruce Whealton <br...@whealton.info> wrote:
> Hello,
> Thanks Walter for your suggestions and information. I definitely
> follow advice. Here's some surprising news. I actually got everything
> working right inside Windows while still trying to get things to work in
> Linux!!! My Linux installation does not even have the mysql gem or the
> mysql2 gem installed. I thought for sure I had it installed earlier.
> Some of the issues of trying to get Rails working in Linux as
> recommended deal with my ability to do simple things like capture the output
> of any command to a file. This would greatly help me to answer some of your
> questions about what is going wrong.

In a terminal you can probably do Edit > Copy (or Ctrl-Shift-C) then
open your editor and paste the contents in and save it.

By the way you are much more likely to get helpful answers here if you
can keep your questions simple. No need to give us your life history,
just describe the problem you are having. Also best to ask only one
question at a time.

Colin
Reply all
Reply to author
Forward
0 new messages