ruby / rails newbie - Finding documentation in RDocs

Discussion in 'Ruby' started by steveH, Sep 4, 2005.

  1. steveH

    steveH Guest

    Hi, I'm brand new to ruby, to which I've been attracted by rails (along
    with many others, no doubt). I'm trying to hack together my first rxml
    template, but my first dip into the rdocs is a total failure. I see
    code like this...

    <% for column in Product.content_columns %>
    <th><%= column.human_name %></th>
    <% end %>

    but I can't find a description of class Column anywhere - can't see it
    in rails docs, core ruby docs, MySQL/Ruby docs - have I just missed it
    or is it somewhere else, or isn't it a class at all but some sort of
    dynamic ruby magic which I've totally misunderstood...

    thanks for any help
     
    steveH, Sep 4, 2005
    #1
    1. Advertising

  2. steveH

    James Britt Guest

    steveH wrote:
    > Hi, I'm brand new to ruby, to which I've been attracted by rails (along
    > with many others, no doubt). I'm trying to hack together my first rxml
    > template, but my first dip into the rdocs is a total failure. I see
    > code like this...
    >
    > <% for column in Product.content_columns %>
    > <th><%= column.human_name %></th>
    > <% end %>
    >
    > but I can't find a description of class Column anywhere - can't see it
    > in rails docs, core ruby docs, MySQL/Ruby docs - have I just missed it
    > or is it somewhere else, or isn't it a class at all but some sort of
    > dynamic ruby magic which I've totally misunderstood...
    >


    In the construct

    for x in some.collection
    ...
    end

    x is a variable that takes on the file of each successive item in
    collection.

    See

    http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_containers.html

    and, in general,

    http://www.ruby-doc.org/docs/ProgrammingRuby/
    http://www.ruby-doc.org/gettingstarted/


    James


    --

    http://www.ruby-doc.org - The Ruby Documentation Site
    http://www.rubyxml.com - News, Articles, and Listings for Ruby & XML
    http://www.rubystuff.com - The Ruby Store for Ruby Stuff
    http://www.jamesbritt.com - Playing with Better Toys
     
    James Britt, Sep 4, 2005
    #2
    1. Advertising

  3. steveH

    Dave Burt Guest

    James Britt offered:
    > steveH wrote:
    >> <% for column in Product.content_columns %>
    >> <th><%= column.human_name %></th>
    >> <% end %>
    >>
    >> but I can't find a description of class Column anywhere - can't see it
    >> in rails docs, core ruby docs, MySQL/Ruby docs - have I just missed it
    >> or is it somewhere else, or isn't it a class at all but some sort of
    >> dynamic ruby magic which I've totally misunderstood...

    >
    > In the construct
    >
    > for x in some.collection
    > ...
    > end
    >
    > x is a variable that takes on the file of each successive item in
    > collection.
    >
    > See [...]


    James is right, there is no explicit type or class set for column, or indeed
    any Ruby variable. All Ruby variables have the dynamic ruby magic property
    of being able to hold an object of any type.

    Here's some trivia realted to your question, though. For most or all of the
    connection adapters, content_columns will return an Array of Column, a.k.a.
    ActiveRecord::ConnectionAdapters::Column, which is a class in Rails, but
    doesn't appear in the API docs. It has properties: name, default, type and
    limit. You can read the source code for ConnectionAdapters, the
    AbstractAdapter, and the adapter for your database if you want to know more.

    Cheers,
    Dave
     
    Dave Burt, Sep 4, 2005
    #3
  4. steveH

    steveH Guest

    thanks very much for both the above
     
    steveH, Sep 5, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joel VanderWerf

    building rdocs for Rake

    Joel VanderWerf, Mar 5, 2005, in forum: Ruby
    Replies:
    10
    Views:
    207
    Tom Copeland
    Mar 8, 2005
  2. Lloyd Zusman

    How to view the rdocs for gems?

    Lloyd Zusman, Sep 7, 2005, in forum: Ruby
    Replies:
    3
    Views:
    127
    Lloyd Zusman
    Sep 7, 2005
  3. George Moschovitis
    Replies:
    5
    Views:
    171
    guest
    Jan 19, 2006
  4. Reid Thompson
    Replies:
    0
    Views:
    114
    Reid Thompson
    Apr 8, 2009
  5. Intransition

    Ruby's RDocs

    Intransition, Jun 27, 2010, in forum: Ruby
    Replies:
    4
    Views:
    93
    Josh Cheek
    Jun 27, 2010
Loading...

Share This Page