Pål Bergström
2006-Jul-14 09:17 UTC
[Rails] Don''t understand :: in ActionController::Base
Maybe this should apply to Ruby forums directly, but I''ll try here. I understand the concept of classes and subclasses thanks to the excellent "Programming Ruby - The Pragmatic Programmer''s Guide". However, I don''t understand what :: signify in terms of inheritance, parent and child in e.g. ActionController::Base -- Posted via http://www.ruby-forum.com/.
P?l Bergstr?m wrote:> Maybe this should apply to Ruby forums directly, but I''ll try here. > > I understand the concept of classes and subclasses thanks to the > excellent "Programming Ruby - The Pragmatic Programmer''s Guide". > However, I don''t understand what :: signify in terms of inheritance, > parent and child in e.g. > > ActionController::Base >You''re correct, this is definitely not a question for rails-talk. Take a look at ruby-talk instead. (Btw, if you actually have read the pickaxe, may I refer you to chapter 9, starting at page 117?) -- Ola Bini (http://ola-bini.blogspot.com) JvYAML, RbYAML, JRuby and Jatha contributor System Developer, Karolinska Institutet (http://www.ki.se) OLogix Consulting (http://www.ologix.com) "Yields falsehood when quined" yields falsehood when quined.
dblack@wobblini.net
2006-Jul-14 11:33 UTC
[Rails] Don''t understand :: in ActionController::Base
Hi -- On Fri, 14 Jul 2006, Pål Bergström wrote:> Maybe this should apply to Ruby forums directly, but I''ll try here. > > I understand the concept of classes and subclasses thanks to the > excellent "Programming Ruby - The Pragmatic Programmer''s Guide". > However, I don''t understand what :: signify in terms of inheritance, > parent and child in e.g. > > ActionController::Base:: navigates through nested classes and modules. So what you''ve got in the Rails source code is basically: module ActionController class Base end end (plus the actual code that does anything :-) So now there''s a class called ActionController::Base, from which your controller classes can inherit. David -- http://www.rubypowerandlight.com => Ruby/Rails training & consultancy http://www.manning.com/black => RUBY FOR RAILS (reviewed on Slashdot, 7/12/2006!) http://dablog.rubypal.com => D[avid ]A[. ]B[lack''s][ Web]log dblack@wobblini.net => me
Pål Bergström
2006-Jul-14 11:59 UTC
[Rails] Re: Don''t understand :: in ActionController::Base
Ola Bini wrote:> P?l Bergstr?m wrote: >> Maybe this should apply to Ruby forums directly, but I''ll try here. >> >> I understand the concept of classes and subclasses thanks to the >> excellent "Programming Ruby - The Pragmatic Programmer''s Guide". >> However, I don''t understand what :: signify in terms of inheritance, >> parent and child in e.g. >> >> ActionController::Base >> > > You''re correct, this is definitely not a question for rails-talk. Take a > look at ruby-talk instead. (Btw, if you actually have read the pickaxe, > may I refer you to chapter 9, starting at page 117?)Definitely was harsh. I thought ActionController::Base was part of RoR :-) I read it on the web with no chapters, so if you could be more specific I would be very thankful. -- Posted via http://www.ruby-forum.com/.
Brian Hogan
2006-Jul-14 12:30 UTC
[Rails] Re: Don''t understand :: in ActionController::Base
Put simply.... you have to understand Ruby before you really understand Rails. David Black''s excellent book Ruby for Rails is a definite read if you are having trouble with the concepts. Don''t take this personally, but there have been a lot of questions posted to this list lately that really have more to do with the fundamentals of the Ruby language than with the way Rails works. Sometimes the line is blurry and it''s hard to tell. -bph. On 7/14/06, P?l Bergstr?m <pal@palbergstrom.com> wrote:> > Ola Bini wrote: > > P?l Bergstr?m wrote: > >> Maybe this should apply to Ruby forums directly, but I''ll try here. > >> > >> I understand the concept of classes and subclasses thanks to the > >> excellent "Programming Ruby - The Pragmatic Programmer''s Guide". > >> However, I don''t understand what :: signify in terms of inheritance, > >> parent and child in e.g. > >> > >> ActionController::Base > >> > > > > You''re correct, this is definitely not a question for rails-talk. Take a > > look at ruby-talk instead. (Btw, if you actually have read the pickaxe, > > may I refer you to chapter 9, starting at page 117?) > > Definitely was harsh. I thought ActionController::Base was part of RoR > :-) > > I read it on the web with no chapters, so if you could be more specific > I would be very thankful. > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060714/c506bcc7/attachment.html
Pål Bergström
2006-Jul-14 13:12 UTC
[Rails] Re: Re: Don''t understand :: in ActionController::Base
Brian Hogan wrote:> Put simply.... you have to understand Ruby before you really understand > Rails. David Black''s excellent book Ruby for Rails is a definite read if > you > are having trouble with the concepts. > > Don''t take this personally, but there have been a lot of questions > posted to > this list lately that really have more to do with the fundamentals of > the > Ruby language than with the way Rails works. Sometimes the line is > blurry > and it''s hard to tell. > > -bph.I understand. Don''t worry Brian. I don''t take it personally. Not the first time I use a forum and give answers myself. We''re all newbies in the beginning, and it sometimes takes some patience with the level people are on. But I always try to give my best to those who ask, no matter what, and not give non-answers. :-) I can''t help Ruby and RoR is so closely related and the documentation is what it is. Maybe this is why you get a lot of questions about Ruby here in RoR? The documentation has some things to wish for. Not Ruby itself. That has been the easy part. But I haven''t read all of it, as I want to get started as soon as possible by building in RoR and learn as I go along. That is how I''ve learned other languages. For what I know a question in the Ruby forum could give the answer that :: is a RoR thing and should be answered here. Right? So I''ll pop over to the Ruby forum and ask there. Maybe I''ll see you there? :-) -- Posted via http://www.ruby-forum.com/.
Christian Reiniger
2006-Jul-15 08:39 UTC
[Rails] Re: Re: Don''t understand :: in ActionController::Base
On Friday 14 July 2006 13:11, P?l Bergstr?m wrote:> I can''t help Ruby and RoR is so closely related and the documentation > is what it is. Maybe this is why you get a lot of questions about Ruby > here in RoR? The documentation has some things to wish for. Not Ruby > itself. That has been the easy part.But your problem *is* with ruby itself.> For what I know a > question in the Ruby forum could give the answer that :: is a RoR thing > and should be answered here. Right?It''s pretty rare (even in the ruby world) that a framework adds its own custom operator(s) to a language :) Re-read the relevant parts of the pickaxe -- good keywords to look for are e.g. "namespace", "operator", "modules" -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://wrath.rubyonrails.org/pipermail/rails/attachments/20060715/5d180ffa/attachment.bin