Hello All! I''m novice at ROR. Would you like to explain what mean such constuction in Ruby. 1: class DemoController < ActionController::Base 2: scaffold :item 3: end Is 2th line calling of method ''scaffold''? If it is so, when it called? For all instances of class, or only for class? I watch sources of ActionController, but don''t understand completely. Thanks. -- Alexey Vakhov mailto:vakhov@gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060816/451cab50/attachment.html
Alexey Vakhov wrote:> Hello All! > > I''m novice at ROR. Would you like to explain what mean such > constuction in Ruby. > > 1: class DemoController < ActionController::Base > 2: scaffold :item > 3: end > > Is 2th line calling of method ''scaffold''? If it is so, when it called? > For all instances of class, or only for class? > I watch sources of ActionController, but don''t understand completely. >Hi Alex, In simple terms, that line (#2) tells Rails to create the basic pages for the object/model called ''item''. That will allow the DemoController to create simple dynamic pages to: create, retrieve, update and delete objects of the type ''item'' Hope this helps, mohit.
On Wed, 2006-08-16 at 11:23 +0400, Alexey Vakhov wrote:> Hello All! > > I''m novice at ROR. Would you like to explain what mean such > constuction in Ruby. > > 1: class DemoController < ActionController::Base > 2: scaffold :item > 3: end > > Is 2th line calling of method ''scaffold''?That would be ''2nd'' line. :-s English - it''s weird. It''s calling a class method ''scaffold'', which as far as I know generates the necessary instance methods in the DemoController class.> If it is so, when it called?The first time the DemoController class definition is executed.> For all instances of class, or only for class? > I watch sources of ActionController, but don''t understand completely.Yeah, it baffled me the first time I saw it too. bye John