Forum: Ruby on Rails How dows RoR work?

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.
3275da7fdbd73cb4e7956fd0d29164de?d=identicon&s=25 Paul Bergstrom (palb)
on 2006-06-06 23:37
This is so frustrating. Is RoR that easy to learn or is it hype or is it
just me? I wonder how many newbies like me are surfing the docs trying
to get a clue of the basics. Every tutorial I find is much the same, and
seems to skip the fundmental parts. How should you understand the Ruby
API http://api.rubyonrails.org/?

What is < ActionController::Base? Can't I set a cookie under that? Or do
I have to use that under ActionController::Cookies? I don't get it.
Daf712bc189bfe835545a2977bf00da4?d=identicon&s=25 Guest (Guest)
on 2006-06-06 23:52
Why do u need to set a cookie?

Pål Bergström wrote:
> This is so frustrating. Is RoR that easy to learn or is it hype or is it
> just me? I wonder how many newbies like me are surfing the docs trying
> to get a clue of the basics. Every tutorial I find is much the same, and
> seems to skip the fundmental parts. How should you understand the Ruby
> API http://api.rubyonrails.org/?
>
> What is < ActionController::Base? Can't I set a cookie under that? Or do
> I have to use that under ActionController::Cookies? I don't get it.
429500a5a54600958c9c7ac032a37f66?d=identicon&s=25 Joe (Guest)
on 2006-06-07 00:01
Pål Bergström wrote:
> This is so frustrating. Is RoR that easy to learn or is it hype or is it
> just me? I wonder how many newbies like me are surfing the docs trying
> to get a clue of the basics. Every tutorial I find is much the same, and
> seems to skip the fundmental parts. How should you understand the Ruby
> API http://api.rubyonrails.org/?
>
> What is < ActionController::Base? Can't I set a cookie under that? Or do
> I have to use that under ActionController::Cookies? I don't get it.

Read Agile Web Development with Rails - it's a must in my opinion.
Contains a lot of stuff that's not in the docs.

Joe
3275da7fdbd73cb4e7956fd0d29164de?d=identicon&s=25 Paul Bergstrom (palb)
on 2006-06-07 00:07
Guest wrote:
> Why do u need to set a cookie?
>
> Pål Bergström wrote:
>> This is so frustrating. Is RoR that easy to learn or is it hype or is it
>> just me? I wonder how many newbies like me are surfing the docs trying
>> to get a clue of the basics. Every tutorial I find is much the same, and
>> seems to skip the fundmental parts. How should you understand the Ruby
>> API http://api.rubyonrails.org/?
>>
>> What is < ActionController::Base? Can't I set a cookie under that? Or do
>> I have to use that under ActionController::Cookies? I don't get it.

Just an example.
D0cd6b10e01bacb976b3b815a9c660bc?d=identicon&s=25 Alex Wayne (Guest)
on 2006-06-07 00:17
> Read Agile Web Development with Rails - it's a must in my opinion.

This is the correct answer, but make sure to get the second edition.

As for cookies:

  cookies[:foo] = 'bar'

The next day:

  my_cookie = cookies[:foo]
  # my_cookie's value is now 'bar'
3275da7fdbd73cb4e7956fd0d29164de?d=identicon&s=25 Paul Bergstrom (palb)
on 2006-06-07 00:46
Alex Wayne wrote:
>> Read Agile Web Development with Rails - it's a must in my opinion.
>
> This is the correct answer, but make sure to get the second edition.
>
> As for cookies:
>
>   cookies[:foo] = 'bar'
>
> The next day:
>
>   my_cookie = cookies[:foo]
>   # my_cookie's value is now 'bar'

Thanks Alex. But this wasn't my initial concern. More how I should read
the API. Can I use the cookie object under < ActionController::Base?
3275da7fdbd73cb4e7956fd0d29164de?d=identicon&s=25 Paul Bergstrom (palb)
on 2006-06-07 00:51
Joe wrote:
> Pål Bergström wrote:
>> This is so frustrating. Is RoR that easy to learn or is it hype or is it
>> just me? I wonder how many newbies like me are surfing the docs trying
>> to get a clue of the basics. Every tutorial I find is much the same, and
>> seems to skip the fundmental parts. How should you understand the Ruby
>> API http://api.rubyonrails.org/?
>>
>> What is < ActionController::Base? Can't I set a cookie under that? Or do
>> I have to use that under ActionController::Cookies? I don't get it.
>
> Read Agile Web Development with Rails - it's a must in my opinion.
> Contains a lot of stuff that's not in the docs.
>
> Joe

I already got it. I'll give it more time :-)
D0cd6b10e01bacb976b3b815a9c660bc?d=identicon&s=25 Alex Wayne (Guest)
on 2006-06-07 01:34
> Thanks Alex. But this wasn't my initial concern. More how I should read
> the API. Can I use the cookie object under < ActionController::Base?

Don't start with the API.  You have be a little familiar with Rails
before the API make much sense.  Once you have the basics of the MVC
setup of rails and can make a sample then start exploring the API.

That said, here's a very basic intro.

Click around in the "Classes" frame and you will see a blurb at the top
of the documentation for each class describing how its method are used.
Below that is the actual methods in that class and what they do.  There
is quite a bit of depth in some of the class hierarchies, but for the
most classes that start with ActionController have methods accessible in
your controller, ActiveRecord methods for the model, and ActionView is
methods for the view.

The top pane, is kinda useless for the most part.  The bottom pane is an
alphabetical listing of every method, from every class, in the entire
framework.  Use it if you are looking up how particular method works,
and you already know its name.
9d7d8ef2179661d6b30e180fa588cd45?d=identicon&s=25 Calle Dybedahl (Guest)
on 2006-06-07 15:31
(Received via mailing list)
>>>>> "Pål" == Pål Bergström <pal@palbergstrom.com> writes:

> Is RoR that easy to learn or is it hype or is it just me?

Well, it took me all of one day to learn enough to start doing my own
things in it. Still doesn't know it all, though.

> How should you understand the Ruby API http://api.rubyonrails.org/?

Well...

> What is < ActionController::Base?

...you do need at least a basic understanding of _Ruby_ first. And
that question shows that you don't have that. So, for the moment, stop
focusing on Rails and read a couple of Ruby tutorials.

An alternative is to buy the AWDwR book and read it.
--
		     Calle Dybedahl <calle@cyberpomo.com>
		 http://www.livejournal.com/users/cdybedahl/
  "All printers are unreliable contraptions from the depths of hell sent
to
		     torture sysadmins." -- Russ Allbery
Be09addcbb47f2a684fa5c48bac94149?d=identicon&s=25 David Johnson (Guest)
on 2006-06-07 15:43
(Received via mailing list)
... and also post  questions to this list.  Ruby is sweet, but it is
still maturing and it is different enough from anything else out there
that there is a learning curve.

Part of the problem you are seeing is that much of the RoR information
presumes that you are already an accomplished HTML+javascript+taglib
programmer.  I am spending more time learning these three than either
Ruby or Rails, and I started into this curve with a high level of
general programming knowledge.

<rant>
Last night, I ended up ripping out the RoR generated tags from my
learning project and replacing them with plain old HTML with embedded
ruby instructions, just so I could understand and control what I was
seeing.  Taglibs may be great for experienced HTML programmers, but to a
relative novice they just make the code unreadable.
</rant>

We would have this part of the learning curve regardless of what back-
end programming language/framework we used (jsp, vbs, php, etc), so it
is not appropriate to point the finger at RoR as being hard to learn.
753528fbc8b89d5f3bbcd5558c36d168?d=identicon&s=25 Glenn Cadman (glenn)
on 2006-06-07 15:59
I found that the learning curve is steep, particular if you want to
start coding non trivial realworld apps.

To get RoR to do something useful and "professional" looking , you need
to understand ruby basics plus a quite a detailed understanding of CSS,
HTML and the ROR API. For me it is very hard to "think solutions"

The joy of course is that you can code non-trival realworld apps,
whereas in Java or even PHP everything soon decays into a "big ball of
mud".

For me moving to the eclipse programing environment, with the ROR addons
helped a lot as when you are programing you seem to need to change a
many files just a little it also helps highlight the syntax bloopers
newbies make.
6ef8cb7cd7cd58077f0b57e4fa49a969?d=identicon&s=25 Brian Hogan (Guest)
on 2006-06-07 19:54
(Received via mailing list)
I believe that it is exteremly important that you first learn how MVC
(model-view-controller) is supposed to work.

ActionController::Base is the base class for action controller, the
controller part of the Rails framework. Your controllers need to
extend this class because it provides session, request, response, and
other get/post CGI stuff.

I think prerequisites for Rails are the following:
1. Basic knowledge about relational databases (and ability to do some
SQL if needed)
2. Basic HTML and Javascript skills (Less JS than HTML -- stay away
from AJAX for awhile)
3. Experience programming in ASP, PHP, Java (with JSPs), or Perl... so
you have an understanding of how web-to-database applications work.

If you're missing one of these skills, it's not a show stopper... it
just means you'll need to work harder. The Agile book is great. Do the
depot app and then read teh chapters that follow. They will give you
an inisight into what you were building. This helped me a lot.

Ruby on Rails really shines when you can appreciate what it is capable
of doing for you.
15f79f3bf0170e6297ce3d9c21101a70?d=identicon&s=25 Daniel Thompson (Guest)
on 2006-06-07 20:29
(Received via mailing list)
> This is so frustrating. Is RoR that easy to learn or is it hype or is it
> just me?

I think all the other points made to you are very good. However, I
wanted to
add that I didn't begin to really understand how RoR worked until I had
it
in vendor/rails. Once it's in there, I could set breakpoints and begin
to
understand the *how* part.

Good luck,
-DT (using RoR for 2 weeks now)
6d57db44c5a4e0721cc7f78cf0ce308a?d=identicon&s=25 Stephen Bartholomew (steveb)
on 2006-06-07 20:33
> I believe that it is exteremly important that you first learn how MVC
> (model-view-controller) is supposed to work.
I second that.

Everything else is no different from any other web programming language
you learn.  Rails is just as much an approach to website development as
it is anything else.

With the HTML/JS/SQL argument when talking about Rails, i think these
skills are prerequisites of *any* web programming language.  If you
don't know these things i think you would struggle to make a
'professional' app in PHP or ASP or whatever - not just Rails.

The Agile book is a must - read from cover to cover and try out all the
examples.  Then do it again.  I just keep reading it over and i normally
find new stuff each time :0)

Steve


Brian Hogan wrote:
> I believe that it is exteremly important that you first learn how MVC
> (model-view-controller) is supposed to work.
>
> ActionController::Base is the base class for action controller, the
> controller part of the Rails framework. Your controllers need to
> extend this class because it provides session, request, response, and
> other get/post CGI stuff.
>
> I think prerequisites for Rails are the following:
> 1. Basic knowledge about relational databases (and ability to do some
> SQL if needed)
> 2. Basic HTML and Javascript skills (Less JS than HTML -- stay away
> from AJAX for awhile)
> 3. Experience programming in ASP, PHP, Java (with JSPs), or Perl... so
> you have an understanding of how web-to-database applications work.
>
> If you're missing one of these skills, it's not a show stopper... it
> just means you'll need to work harder. The Agile book is great. Do the
> depot app and then read teh chapters that follow. They will give you
> an inisight into what you were building. This helped me a lot.
>
> Ruby on Rails really shines when you can appreciate what it is capable
> of doing for you.
3275da7fdbd73cb4e7956fd0d29164de?d=identicon&s=25 Paul Bergstrom (palb)
on 2006-06-07 21:40
Glenn Cadman wrote:
> I found that the learning curve is steep, particular if you want to
> start coding non trivial realworld apps.

That's what I found to. Not very hard to understand the basics and the
mvc-model, but not enough for more serious stuff.

If someone could just explain the MmmController <
ActionController::Basic or ActionController::Cookies etc, it would be
great. I search but I can't find that explained. Then it would really
click.

Could also be that I'm not that familiare with classes. I can do rather
complex stuff in php, but classes isn't my strong side. Perhaps this is
the problem.

>
> To get RoR to do something useful and "professional" looking , you need
> to understand ruby basics plus a quite a detailed understanding of CSS,
> HTML and the ROR API. For me it is very hard to "think solutions"

With the little I've read so far I found Ruby quite easy, compared to
PHP. And what you say makes sense. I got the other part, trying to be in
the forefront of standards, but I need to think in solutions.

>
> The joy of course is that you can code non-trival realworld apps,
> whereas in Java or even PHP everything soon decays into a "big ball of
> mud".

True. :-)

>
> For me moving to the eclipse programing environment, with the ROR addons
> helped a lot as when you are programing you seem to need to change a
> many files just a little it also helps highlight the syntax bloopers
> newbies make.

I also use eclipse more and more. I was glad to find RadRails.

Thanks for your input.
3275da7fdbd73cb4e7956fd0d29164de?d=identicon&s=25 Paul Bergstrom (palb)
on 2006-06-07 21:45
Brian Hogan wrote:
> I believe that it is exteremly important that you first learn how MVC
> (model-view-controller) is supposed to work.
>
> ActionController::Base is the base class for action controller, the
> controller part of the Rails framework. Your controllers need to
> extend this class because it provides session, request, response, and
> other get/post CGI stuff.
>

Ok. I'll have to think on that for a while.


> I think prerequisites for Rails are the following:
> 1. Basic knowledge about relational databases (and ability to do some
> SQL if needed)

Got that.

> 2. Basic HTML and Javascript skills (Less JS than HTML -- stay away
> from AJAX for awhile)

That to. Not so much AJAX, but I'm not so sure on security there.

> 3. Experience programming in ASP, PHP, Java (with JSPs), or Perl... so
> you have an understanding of how web-to-database applications work.
>

Yes. Started in Lasso, which is more in class with Ruby in easiness.
Then PHP.

> If you're missing one of these skills, it's not a show stopper... it
> just means you'll need to work harder. The Agile book is great. Do the
> depot app and then read teh chapters that follow. They will give you
> an inisight into what you were building. This helped me a lot.
>
> Ruby on Rails really shines when you can appreciate what it is capable
> of doing for you.

Sounds good :-)
39c5254d0a798765f37ac215fa6e0fc7?d=identicon&s=25 Curtis Spendlove (cuspendlove)
on 2006-06-07 21:51
(Received via mailing list)
On 6/7/06, Pål Bergström <pal@palbergstrom.com> wrote:
> If someone could just explain the MmmController <
> ActionController::Basic or ActionController::Cookies etc, it would be
> great. I search but I can't find that explained. Then it would really
> click.
>
> Could also be that I'm not that familiare with classes. I can do rather
> complex stuff in php, but classes isn't my strong side. Perhaps this is
> the problem.

That's your problem.  As others have mentioned, it helps to take a
crash course in Ruby (there was a very good announcemtn of an online
pdf first chapter of a book I plan on getting when it's released, but
my Mt Dew deprived brain cannot pull it forward at the time).

The Class < SuperClass construct is basically just saying that your
controller is a subclass of one of the other types of controllers.  If
you want to be able to use the stuff in ActionController::Basic,
inherit from that; if you need stuff from ActionController::Cookies,
inherit from that.  You can then call any of the applicable functions
from the superclass straight from the subclass (your controller).

If you're not familar with OOP, learn about it and it will make sense.
 The Object functionality of PHP is not a great model for true OOP
languages...


-Curtis
This topic is locked and can not be replied to.