Forum: Ruby on Rails A noob question for direction

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
9da68e7e2cb1432b423c75e782714929?d=identicon&s=25 John Dean (magnifico)
on 2009-02-02 10:10
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!
5772c599ccab3081e0fffb1d54f3b6de?d=identicon&s=25 Andrew Timberlake (andrewtimberlake)
on 2009-02-02 11:43
(Received via mailing list)
On Mon, Feb 2, 2009 at 11:10 AM, John Dean
<rails-mailing-list@andreas-s.net
> 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 Timberlake
http://ramblingsonrails.com
http://www.linkedin.com/in/andrewtimberlake

"I have never let my schooling interfere with my education" - Mark Twain
3131fcea0a711e5ad89c8d49cc9253b4?d=identicon&s=25 Julian Leviston (Guest)
on 2009-02-02 11:53
(Received via mailing list)
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 Dean <rails-mailing-list@andreas-
9da68e7e2cb1432b423c75e782714929?d=identicon&s=25 John Dean (magnifico)
on 2009-02-02 12:55
Julian Leviston 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 Dean <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?
54f7ef5bffa0ba5de25ff723e4de94b8?d=identicon&s=25 RailsExpert.com (Guest)
on 2009-02-02 20:12
(Received via mailing list)
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
9da68e7e2cb1432b423c75e782714929?d=identicon&s=25 John Dean (magnifico)
on 2009-02-02 20:24
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!
9da68e7e2cb1432b423c75e782714929?d=identicon&s=25 John Dean (magnifico)
on 2009-02-03 21:50
Anyone? Anything?
8d38199a01d2243e313c48456c6ddff9?d=identicon&s=25 Daly (Guest)
on 2009-02-03 22:32
(Received via mailing list)
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-de...
which if I remember correctly takes you step by step in building an
online store.
5ff877aa96e97d405e4fc876fb87cd2c?d=identicon&s=25 Graeme (Guest)
on 2009-02-04 17:02
(Received via mailing list)
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-Develo...
which focuses more on Ruby but from a Rails perspective.
9da68e7e2cb1432b423c75e782714929?d=identicon&s=25 John Dean (magnifico)
on 2009-02-04 18:55
Thanks guys - just got the
http://www.pragprog.com/titles/rails3/agile-web-de...
one v3.

Will read!
247cd3d37084a3d6794076207bd9fbd7?d=identicon&s=25 Bob Martens (Guest)
on 2009-02-05 04:02
(Received via mailing list)
Enjoy it is a good point, and a good launchpad into more reading and
more testing.

On Feb 4, 11:55 am, John Dean <rails-mailing-l...@andreas-s.net>
This topic is locked and can not be replied to.