A noob question for direction


#1

Hello folks!

I’m new here as you would soon see from my post. I started reading
http://pine.fm/LearnToProgram/ and am somewhat “getting it”… I do find
some difficulties understanding the flow of things, but I do get the
logic. I guess it all comes with determination and practice.

Well, enough talk. I have a question for you guys - should I continue
reading Pine’s guide on Ruby or start reading something on Ruby on
Rails? I don’t quite get what the real difference is between them, but
from what I did manage to get is that ROR is a “gateway” type of
scripting that should allow for an easier and more simple implementation
and use of the Ruby language - is that so?

For me personally it’ll be much easier to learn if after I read the
basic stuff (eg. a manual and get an approximate idea of how things
work) to get my hands on some practical scripts and start messing around
with them to see what actually happens - I’m more of the “visual”
learner and I really need to actually “see” things in order to
understand them.

Thank you all in advance for your responses!


#2

On Mon, Feb 2, 2009 at 11:10 AM, John D.
<removed_email_address@domain.invalid

wrote:

Rails? I don’t quite get what the real difference is between them, but

Thank you all in advance for your responses!

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

Ruby is a scripting language.
Ruby on Rails is a web framework that uses Ruby as it’s underlying
scripting
language.
You need to know Ruby to work with Ruby on Rails.

Learn Ruby as a language and then, if you’re interested in creating
websites
with Ruby, look at Ruby on Rails.


Andrew T.
http://ramblingsonrails.com
http://www.linkedin.com/in/andrewtimberlake

“I have never let my schooling interfere with my education” - Mark Twain


#3

The best way to learn is to have a real problem you want solved. Then
try, fail and ask questions when you’re stuck.

Sent from my iPhone

On 02/02/2009, at 8:10 PM, John D. <rails-mailing-list@andreas-


#4

Julian L. wrote:

The best way to learn is to have a real problem you want solved. Then
try, fail and ask questions when you’re stuck.

Sent from my iPhone

On 02/02/2009, at 8:10 PM, John D. <rails-mailing-list@andreas-

OK I do have a real project in mind. It’s pretty simple for an
experienced programmer as it’s a pretty straightforward thing.

I need a web site template that will have variables on it like [var1]
[var2] etc. And I want these variables to be replaced with text from a
DB. You’ll call the script with some parameter in the URL like
domain.com/script.rb?page=1 and it will know that it will replace the
vars with the according ones for the DB record #1.

Nothing really hard just a dynamic template page…

So where do I go from here?


#5

John,
I am not sure exactly what you’re asking but if you are trying to
‘personalize’ many separate websites based on the calling domain
( something.com ) then I might be able to help.
I created a synthetic example of this at WebRancher.com where one code
based reads the ‘request.host’ object and based on the domain name
serves the appicable data to the application framework.
David


#6

Anyone? Anything?


#7

RailsExpert.com wrote:

John,
I am not sure exactly what you’re asking but if you are trying to
‘personalize’ many separate websites based on the calling domain
( something.com ) then I might be able to help.
I created a synthetic example of this at WebRancher.com where one code
based reads the ‘request.host’ object and based on the domain name
serves the appicable data to the application framework.
David

Here’s thing…

First I have a DB that goes something like this:

ID BRAND EST_YEAR HISTORY CURRENT_MODELS etc etc
1 BMW 1900 blah,blah,blah 1series,3series,5series
2 MercedesBenz 1901 blah,blah,blah c-klasse,e-klasse,s-klasse
3 Audi 1902 blah,blah,blah a3,a4,a5,a6,a8

Then someone goes to this script here on my domain:

http://www.MyDomain.com/car-data.rb?carBrand=BMW
http://www.MyDomain.com/car-data.rb?carBrand=MercedesBenz
http://www.MyDomain.com/car-data.rb?carBrand=Audi

Now, instead of creating a separate page for each car-brand - which is
both a tedious task and can’t really be updated, etc. once I change the
design of the site for example, or whatever, so instead of having static
HTML pages for each brand I want to create one template page and then
have a script, based on the ‘carBrand’ variable in the link replace
particular fields in that template with the data from the DB.

So for example the template page would look like:

Car Brand: $brand
Established in: $est_year
History information, facts, data, years, etc.: $history
The manufacturer currently has the following models in production:
$current_models

And so on…

And once someone comes with
http://www.MyDomain.com/car-data.rb?carBrand=BMW

It will replace the variables with:

Car Brand: BMW
Established in: 1900
History information, facts, data, years, etc.: blah,blah,blah
The manufacturer currently has the following models in production:
1series,3series,5series

So that’s pretty much my whole idea right now. I’m sure it’s a pretty
basic programming task for someone who knows their way around
programming, but for me it’s still in the dark as I don’t have any
reference point to start from and build on.

So again - all and any suggestions and tips are greatly appreciated!

Thanks again guys!


#8

As a relative newbie myself I would second this recommendation. Just
make sure you get version 3 - Ruby on Rails changed a lot between 1.xx
and 2.00.

An older book that I still find useful is
http://www.amazon.com/Ruby-Rails-Techniques-Developers/dp/1932394699
which focuses more on Ruby but from a Rails perspective.


#9

John, if you want to learn Ruby and Ruby on Rails, you probably need
to start by buying a book first that explains all the basics of the
language. A lot of people start with this one for Rails:
http://www.pragprog.com/titles/rails3/agile-web-development-with-rails-third-edition
which if I remember correctly takes you step by step in building an
online store.


#10

Thanks guys - just got the
http://www.pragprog.com/titles/rails3/agile-web-development-with-rails-third-edition
one v3.

Will read!


#11

Enjoy it is a good point, and a good launchpad into more reading and
more testing.

On Feb 4, 11:55 am, John D. removed_email_address@domain.invalid