Ok... i''m going through the "Four Days On Rails" tutorial (as suggested) and i encounter the following (on p. 13): def update @category = Category.find(@params[''category''][''id'']) if @category.update_attributes(@params[''category'']) Now, i know (or thought i knew), roughly speaking, that @params is a variable via which the controller passes query data to the models. This usage (@params[''category''][''id'']) implies to me that @params is a hash and that the element accessed by ''category'' is also a hash. So i want to know more about what @params actually is, because i don''t really understand how (or why) it got to be a hash within a hash. So i search http://api.rubyonrails.org/ for ''params'' (a text search on all the frames) and i come up with... *nothing*. Just *wonderful*. I guess i don''t really need to know *anything* about @params. Just intuitively use it i tell myself. That''s what everybody else seems to be doing. Of course i could look at the code. And i just did. Sorry to say, it hasn''t enlightened me on this point. Question: Is it me? Is it the documentation? Or is that i don''t understand Ruby well enough? craig
Hi Craig, your controller inherits from ApplicationController which inherits from ActionController. If you look at the api docs for ActionController::Base you''ll find a blurb about the params hash. I get your frustration. It sounds like you''re coming from a position of being proficient in another language and/or application framework - in my experience that can be tough (although my long-lost years with perl eases the pain slightly). Keep at it. Trevor On 23-Apr-05, at 4:40 PM, craig duncan wrote:> Ok... i''m going through the "Four Days On Rails" tutorial (as > suggested) and i encounter the following (on p. 13): > > def update > @category = Category.find(@params[''category''][''id'']) > if @category.update_attributes(@params[''category'']) > > Now, i know (or thought i knew), roughly speaking, that @params is a > variable via which the controller passes query data to the models. > This usage (@params[''category''][''id'']) implies to me that @params is a > hash and that the element accessed by ''category'' is also a hash. So i > want to know more about what @params actually is, because i don''t > really understand how (or why) it got to be a hash within a hash. So > i search http://api.rubyonrails.org/ for ''params'' (a text search on > all the frames) and i come up with... *nothing*. Just *wonderful*. I > guess i don''t really need to know *anything* about @params. Just > intuitively use it i tell myself. That''s what everybody else seems to > be doing. Of course i could look at the code. And i just did. Sorry > to say, it hasn''t enlightened me on this point. > > Question: Is it me? Is it the documentation? Or is that i don''t > understand Ruby well enough? > > craig > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Trevor Squires wrote:> Hi Craig, > > your controller inherits from ApplicationController which inherits from > ActionController. If you look at the api docs for > ActionController::Base you''ll find a blurb about the params hash. > > I get your frustration. It sounds like you''re coming from a position of > being proficient in another language and/or application framework - in > my experience that can be tough (although my long-lost years with perl > eases the pain slightly). > > Keep at it. > > TrevorThanks. That bit of documentation actually made it clear. Now i just need to learn how to find this for myself. There''s no index, no search capability. I wonder if everyone just has their own ad-hoc ways of dealing with this situation. craig
Hi Craig, This is version 0.12.1 of an open source project. Currently, development is focussed on getting version 1.0 out. If you like to have better documentation, please contribute. Why not try writing a documentation browser as your first rails project, that adds search capability? -- Thomas Am 24.04.2005 um 5:38 schrieb craig duncan:> Trevor Squires wrote: >> Hi Craig, >> your controller inherits from ApplicationController which inherits >> from ActionController. If you look at the api docs for >> ActionController::Base you''ll find a blurb about the params hash. >> I get your frustration. It sounds like you''re coming from a position >> of being proficient in another language and/or application framework >> - in my experience that can be tough (although my long-lost years >> with perl eases the pain slightly). >> Keep at it. >> Trevor > > Thanks. That bit of documentation actually made it clear. Now i just > need to learn how to find this for myself. There''s no index, no > search capability. I wonder if everyone just has their own ad-hoc > ways of dealing with this situation. > > craig > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Thomas Fuchs wrote:> Hi Craig, > > This is version 0.12.1 of an open source project. > Currently, development is focussed on getting version 1.0 out.I understand that. I deserved that. :-)> If you like to have better documentation, please contribute.I am not presently able to. I am struggling to learn just the basics.> Why not try writing a documentation browser as your first rails project, > that adds search capability?Because it is presently beyond my capability and i already have a project that i am using as the impetus for learning Rails. I appreciate the suggestion but i think it -- as a suggestion -- would be far more relevant to someone who already has written some Rails apps and has a good understanding of the framework. craig
craig duncan <craig-duncan@...> writes:> how to find this for myself. There''s no index, no search capability.Craig, Leeo''s website has a nifty feature for searching api docs using google: http://www.omara.ca/rails/ Very useful. Thanks Leeo! Hammed