Iterating a partial with :collection


#1

following AWDWR book - ‘Partials and Collections’ (rather sparse info
there too) and I might add that the wiki page on this topic is entirely
devoid of any info…be that as it may…

I have hash of several arrays that I want to iterate though and display.

the first hashed element looks like this (greatly simplified)

  • :facility: !ruby/object:Facility
    attributes:
    name: Toby I
    beds_a: “12”
    beds_m: “12”
    id: “1”
    beds_f: “12”
    :placements: []

My view code (fac_log_all_test) is a one liner…
<%= render :partial => ‘fac_log_test’, :collection => @facility_log_run
%>

According to the AWDWR book "Inside the partial, the local variable
‘article’ will be set to the current article from the collection-the
variable is named after the template. In addition, the variable article
counter will be set to the index of the current article in the
collection.

According to my admittedly incomplete understanding, this should work,
but it doesn’t…

<%=h (fac_log_test[:fac_log_test_counter][:facility][:name]) %>

;-(

what is the proper usage?

Craig
NoMethodError in #
Showing app/views/reports/_fac_log_test.rhtml where line #28 raised:

You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.[]

Extracted source (around line #28):

25:


26: FACILITY:
27:
28: <%=h
(fac_log_test[:fac_log_test_counter][:facility][:name]) %>

#2

Hello Craig,

2006/3/15, Craig W. removed_email_address@domain.invalid:

My view code (fac_log_all_test) is a one liner…
<%= render :partial => ‘fac_log_test’, :collection => @facility_log_run %>

According to my admittedly incomplete understanding, this should work, but it doesn’t…

<%=h (fac_log_test[:fac_log_test_counter][:facility][:name]) %>

Drop the :fac_log_test_counter !

<%=h (fac_log_test[:facility][:name]) %>

Running with :collection is equivalent to this:

@facility_log_run.each do |fac_log_test|

partial view code here

end

Did you know about debug ? You could have done this to debug your code:
<%=debug(fac_log_test) %>

That would have shown you a YAML dump of the object.

Hope the helps !


#3

On Wed, 2006-03-15 at 23:19 -0500, Francois B. wrote:

Drop the :fac_log_test_counter !

<%=h (fac_log_test[:facility][:name]) %>


been there and done that…

NoMethodError in #
Showing app/views/reports/_fac_log_test.rhtml where line #28 raised:

You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.[]

Extracted source (around line #28):

25:
26: FACILITY:
27:
28: <%=h
(fac_log_test[:facility][:name]) %>

That would have shown you a YAML dump of the object.


been there and done that…

that’s where I got the listing that I gave you in the last email…

  • :facility: !ruby/object:Facility
    attributes:
    name: Toby I
    beds_a: “12”
    beds_m: “12”
    id: “1”
    beds_f: “12”
    :placements: []

though I used, <%= debug @facility_log %>, I think that if you look
again, you would know why I used that instead.

Trust me, I wouldn’t have asked the list if I hadn’t already exhausted
the meager documentation (less than a full page in AWDWR), a header but
no text on wiki and hours of trial and error.

Hope the helps !


It didn’t but thanks for the effort.

Craig


#4

On Wed, 2006-03-15 at 21:46 -0700, Craig W. wrote:

Did you know about debug ? You could have done this to debug your code:
<%=h (@facility_log[1][:facility][:name]) %>

26:


27: FACILITY:
28:
29: <%=h (@facility_log[fac_log_test][:facility][:name]) %>

craps out…

Is it me or does it seem as though the book is a bit long in the tooth?


nope - forgive me…it seems the combination of the instance variable
@facility_log and the counter fac_log_test_counter does give me
data…not at all what the book describes but it works.

thanks

Craig


#5

On Wed, 2006-03-15 at 21:50 -0700, Craig W. wrote:

I know it’s bad form to reply to one’s self…but I think I have
narrowed things down to one comprehensible posting.

further information as I am very focused now on settling this issue.

Things simply aren’t working like the AWDWR books suggests that it
would. Since I already quoted from the book, I can simplify what is
happening…

My view code *** fac_log_test_all.rhtml ***
<%= render :partial => ‘fac_log_test’, :collection => @facility_log_run
%>

My controller code has…

def fac_log_all_test
@facility_log = facility_log_run( 1, 14 )
end

def facility_log_run number, max
results = []
number.upto(max) do |idx|
facility = Facility.find( idx )
placements = Placement.find(:all,
:conditions => [ “facility_id = ? and
discharge_date IS NULL
and admission_date IS NOT NULL”, idx ])
results << { :facility => facility,
:placements => placements }
end
results
end

and finally…the view code I am using in the partial
_fac_log_test.rhtml

<%=h (@facility_log[fac_log_test_counter][:facility][:name]) %>

which actually prints - no errors except that only one page is rendered

  • (yes, I understand it has something to do with using the instance
    variable but I thought the point of using :collection in the :partial
    was that it would loop through each of the arrays.)

The AWDWR book suggests that I can use a variable, named after the
template (the partial) but it clearly doesn’t work…

<%=h (fac_log_test[fac_log_test_counter][:facility][:name]) %>

NoMethodError in #
Showing app/views/reports/_fac_log_test.rhtml where line #28 raised:

You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.[]

Extracted source (around line #28):

25:


26: FACILITY:
27:
28: <%=h
(fac_log_test[fac_log_test_counter][:facility][:name]) %>

so while the ‘variable’ fac_log_test_counter seems to work like it is
supposed to, the ‘variable’ fac_log_test doesn’t - at least not at all
like the AWDWR book works - and given this state that I am finding, it
simply isn’t possible to iterate through the many records and display
them all.

There is something profoundly wrong but I can’t put my finger on it.

Craig


#6

On Wed, 2006-03-15 at 23:19 -0500, Francois B. wrote:

Drop the :fac_log_test_counter !
<%=debug(fac_log_test) %>

That would have shown you a YAML dump of the object.

Hope the helps !


I should also explain that the reason that I added the
fac_log_test_counter was because the only way I have ever been able to
get data from the hash array was to use…

<%=h (@facility_log[1][:facility][:name]) %>
which actually works

but if I try to use…
<%=h (@facility_log[fac_log_test][:facility][:name]) %>
TypeError in #
Showing app/views/reports/_fac_log_test.rhtml where line #29 raised:

no implicit conversion from nil to integer

Extracted source (around line #29):

26:


27: FACILITY:
28:
29: <%=h
(@facility_log[fac_log_test][:facility][:name]) %>

craps out…

Is it me or does it seem as though the book is a bit long in the tooth?

Craig


#7

Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


#8

On Wed, 2006-03-15 at 23:44 -0600, Dave T. wrote:

On Mar 15, 2006, at 23:33, Craig W. wrote:

There is something profoundly wrong but I can’t put my finger on it.

Where is @facility_log_run getting set?


it was in the code I posted…

def fac_log_all_test
@facility_log = facility_log_run( 1, 14 )
end

I do as best as I can to trim things down to only the relevant items but
enough to see the picture

Craig


#9

On Wed, 2006-03-15 at 23:44 -0600, Dave T. wrote:

On Mar 15, 2006, at 23:33, Craig W. wrote:

There is something profoundly wrong but I can’t put my finger on it.

Where is @facility_log_run getting set?


I’m sorry, I missed the word run…

from the initial view code itself that calls the partials…

My view code *** fac_log_test_all.rhtml ***
<%= render :partial => ‘fac_log_test’, :collection => @facility_log_run
%>

Craig


#10

Hi –

On Wed, 15 Mar 2006, Craig W. wrote:

 name: Toby I

According to my admittedly incomplete understanding, this should work, but it doesn’t…

<%=h (fac_log_test[:fac_log_test_counter][:facility][:name]) %>

:fac_log_test_counter isn’t a variable; it’s a symbol. Try it without
the : and see if that works.

David


David A. Black (removed_email_address@domain.invalid)
Ruby Power and Light, LLC (http://www.rubypowerandlight.com)

“Ruby for Rails” chapters now available
from Manning Early Access Program! http://www.manning.com/books/black


#11

On Thu, 2006-03-16 at 04:52 -0800, removed_email_address@domain.invalid wrote:

the first hashed element looks like this (greatly simplified)
My view code (fac_log_all_test) is a one liner…
<%= render :partial => ‘fac_log_test’, :collection => @facility_log_run %>

According to the AWDWR book "Inside the partial, the local variable ‘article’ will be set to the current article from the collection-the variable is named after the template. In addition, the variable article counter will be set to the index of the current article in the collection.

According to my admittedly incomplete understanding, this should work, but it doesn’t…

<%=h (fac_log_test[:fac_log_test_counter][:facility][:name]) %>

:fac_log_test_counter isn’t a variable; it’s a symbol. Try it without
the : and see if that works.


indeed - that was part of the fix…the other part as Dave suggested was
the :collection => @facility_log (the array of data provided by the
controller and not the method in the controller)

thanks

Craig


#12

Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


#13

On Thu, 2006-03-16 at 09:09 +0100, Mats L. wrote:

from the initial view code itself that calls the partials…
http://lists.rubyonrails.org/mailman/listinfo/rails

I think Daves point was that you are setting the collection
@facility_log and not @facility_log_run in the controller.

Does that help?


yes, that helps a lot - I’m sorry I didn’t understand the clue being
given to me - I think that comes from too many hours on the same
problem.

That did permit it to iterate the ‘outer’ loop and definitely solves my
initial problem…I have to now figure out how to iterate over the inner
loop but I will work it through myself before I ask the list for help.

Interestingly enough though, using the ‘collection’ as set in the
controller still doesn’t fix the issue that I had to use the
‘collection’ as the variable in my view code and it was not as described
in the AWDWR book (Sept 2005 printing) - “The :collection parameter to
render() can be used in conjunction with the :partial parameter.
The :partial parameter lets us use a partial to define the format of an
individual entry, and the :collection parameter applies this template to
each member of the collection.” and then the following paragraph it
states that “the variable is named after the template”

This had me chasing my tail for a long time because I kept trying to use
the name of the partial as the variable name and I could find no
acceptable methodology of making that work.

In addition to this documentation issue, there were a number of people
suggesting that I didn’t need to use the ‘counter’ to identify the
particular array element…

@facility_log[fac_log_test_counter][:facility][:name]
--------| array element ident|

but I couldn’t find any way to make it work without that when iterating
through the array.

I can’t figure out if people just generally don’t do much iterating over
arrays in views. Perhaps there were syntax changes since the AWDWR book
was published and the fact that the wiki page was created on
wiki.rubyonrails.org and then all data was erased makes it extremely
hard to find the proper methodology.

Craig


#14

I don’t think so. If you’re having this problem, then others probably
are as well. My understanding of the counter was that it was orthogonal
to the instance variable accessible to the partial. It’s mostly sugar so
you can do even/odd striping.

Here’s how I understand it to play out:

controller

@foos = Foo.find(:all) => array of Foo’s

view

render :partial => ‘bar’, :collection => @foos

partial _bar

this is iteration number <%= bar_counter %> and the individual array element passed in is <%= bar.some_random_attribute %>.

Google “Four Days on Rails” and dig through the PDF until you find the
example of a striped table. I think it will bear out pretty much what
I’ve written here.

Craig W. wrote:

If this is flogging a dead horse, pass it by. My problem is solved and I
have working code.


#15

On Fri, 2006-03-17 at 06:48 +0100, Steve R. wrote:

view

Craig W. wrote:

If this is flogging a dead horse, pass it by. My problem is solved and I
have working code.


I had no issue with that at all…my ‘counter’ worked…and I had
‘striped’ tables working the first day I started my own rails coding -
compliments of some very clear methodology in AWDWR

Perhaps I didn’t make myself clear and if that’s the case, I probably
wasted everyone’s time with the post and I won’t bother with fixing up
the wiki because if I can’t make it clear to knowledgeable rails users,
how am I ever gonna explain it to someone like me that is struggling
with complicated methodology.

interestingly enough, you are giving me the same explanation that Dave
gave me…if it works for others…which is acceptable as long as you
don’t have to worry about the details. Of course, with
programming…it’s always the details.

Craig


#16

If this is flogging a dead horse, pass it by. My problem is solved and I
have working code.

Yesterday, probably owing to much frustration and my inability to adapt
the information contained in an extremely brief section of the AWDWR
book on ‘partials and collections’ into my working code, I made the
statement, “This had me chasing my tail for a long time because I kept
trying to use the name of the partial as the variable name and I could
find no acceptable methodology of making that work.”

Dave contacted me privately and suggested that “Folks use
render(:partial => …, :collection => …) in almost every
rails application written. I promise you is works.”

and Dave is undoubtedly a lot smarter than I am and certainly light
years ahead of my understanding of everything ruby/rails/programming and
probably a number of other things as well.

His book states that if I were to use…

<%= render(:partial => ‘fac_log_test’, :collection => @facility_log %>
that this --------------^^^^^^^^^^^^
would be my variable in the view code and that I could use
‘fac_log_test_counter’ as an automatic ‘counter’ to use while iterating
through the collection.

Thus if my controller code specifically is

def fac_log_all_test
@facility_log = facility_log_run( 1, 14 )
end

def facility_log_run number, max
results = []
number.upto(max) do |idx|
facility = Facility.find( idx )
placements = Placement.find(:all,
:conditions => [ “facility_id = ?”, idx ])
results << { :facility => facility,
:placements => placements }
end
results
end

and the ‘partial’ code includes ‘my variable’

fac_log_test[fac_log_test_counter][:facility][:name]

that each successive iteration would give me the next facility hashed
inside the array.

thus an array of hashes produced by above method from controller would
look like the data below produced with <% debug @facility_log %> [1]

The issue comes down to this…

*** My understanding *** of the methodology suggested by Dave in AWDWR
as listed above…
within the partial, this should work…

<%= fac_log_test[fac_log_test_counter][:facility][:name] %>

which generates an error [2]

what does work is…
<%=h (@facility_log[fac_log_test_counter][:facility][:name]) %>

which is not how the book describes it at all, ** as I understand it **.

So either my usage is queer, my understanding was wrong or the
methodology suggested in the book isn’t always applicable.

Since there is a complete lack of information about how to iterate using
:partials and :collections on wiki.rubyonrails.org, I am perfectly
willing to provide a healthy write up of the process once I am sure that
I understand it myself.

So if anyone has any input into this process or can provide
clarification…including Dave, please feel free to enlighten me and I
promise to pass that knowledge on to the community via the wiki.

Craig

[1]

  • :facility: !ruby/object:Facility
    attributes:
    name: Toby I
    id: “1”
    :placements:
    • !ruby/object:Placement
      attributes:
      client_id: “32”
      admission_date: “2006-01-18”
  • :facility: !ruby/object:Facility
    attributes:
    name: Toby II
    :placements:
    • !ruby/object:Placement
      attributes:
      client_id: “33”
      admission_date: “2006-01-12”
    • !ruby/object:Placement
      attributes:
      client_id: “46”
      admission_date: “2006-03-12”

[2]
NoMethodError in #
Showing app/views/reports/_fac_log_test.rhtml where line #28 raised:

You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.[]

Extracted source (around line #28):

25:


26: FACILITY:
27:
28: <%=
fac_log_test[fac_log_test_counter][:facility][:name] %>

#17

Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


#18

I’ve been staying out of this thread, because it looked like plenty of
other
people had answered your questions, and you had Dave T. personally
helping
you. I didn’t see that I had much to add. But you’re still confused as
to the
basic nature of how partials with :collection work…

Craig W. wrote:

def fac_log_all_test
:placements => placements }
end
results
end

All of the code above here is fine.

and the ‘partial’ code includes ‘my variable’

fac_log_test[fac_log_test_counter][:facility][:name]

that each successive iteration would give me the next facility hashed
inside the array.

Here’s where your problem has been, from the beginning. The fac_log_test
variable, that is set each time the partial loops through the
collection, is set
to each successive item within the collection. It’s not a copy of the
array of
hashes, it’s set to each hash item within the array, each time the
partial loops.

That’s why the above keeps giving you an error. You need to change the
statement
to read:

fac_log_test[:facility][:name]

which generates an error [2]
Unfortunately, as I stated above, your understanding of this aspect of
partials
with :collection is incorrect. The object you reference as :collection
=> needs
to be an array. That array is then looped over, using the
each_with_index method
provided by the Enumerable mixin (for those who care ;). The partial
only
receives the array item, not the whole array.

what does work is…
<%=h (@facility_log[fac_log_test_counter][:facility][:name]) %>

which is not how the book describes it at all, ** as I understand it **.

Correct. Here you are simply referencing the instance variable that you
generated so you could pass to the collection. If you were going to do
this kind
of referencing, you’re better off putting the loop in the main view
template and
skipping partials altogether.

So either my usage is queer, my understanding was wrong or the methodology
suggested in the book isn’t always applicable.

Actually, what the book states is, in fact, correct. Unfortunately,
somewhere
along the way, you’re understanding of what the book was saying got
muddled. And
you’ve been operating under that mistaken understanding ever since.

Since there is a complete lack of information about how to iterate using
:partials and :collections on wiki.rubyonrails.org, I am perfectly willing to
provide a healthy write up of the process once I am sure that I understand it
myself.

Actually, I never thought one was needed, but that’s because the AWDWR’s
explanation was just fine. Did you ever look at the API page on
partials?
http://api.rubyonrails.org/classes/ActionView/Partials.html

So if anyone has any input into this process or can provide
clarification…including Dave, please feel free to enlighten me and I
promise to pass that knowledge on to the community via the wiki.

Hopefully, I’ve been able to provide some clarification on where your
understanding is off. If not, please ask. Now that I’m in the
discussion, I’ll
do my best to help you get over the hump on this.

-Brian


#19

Craig W. wrote:

I have left in all of the thread on this above to provide continuity and to suggest that I haven’t changed anything else but line #28

OK. What you need to do is figure out what’s actually appearing in the
fac_log_test variable. Since it’s in a partial and the partial is
throwing an
error, you’ll have to do some web dev trickery. What I would do is add a
line
above line 28 (I’m sort of interested to know what else is in your
partial, 28
lines is a big block of lines to be iterating over) that gives you a way
to see
the value. Try this:

<% session[:fac_log_test] = fac_log_test %>

Now, when the partial errors out on you, you’ll be able to view the
current
value of the session, which should contain the fac_log_test value. This
should
shed some light on why trying to reference it like a Hash is throwing an
error.

your explanation makes sense and that is how I thought I understood it
and my problem is that it hasn’t worked for me. So at the moment, my
instance variable with the array of hashes is the only thing that is
working and where the variable itself hasn’t worked - and this is the
focus of this entire discussion.

Yes. But the reason that’s working is because you aren’t changing that
instance
variable after you set it in your controller. I’m guessing that you are
inadvertently changing the value/type of the fac_log_test variable
somewhere in
your partial, before you get to line 28.

My problem with doing that was that I had another loop in the loop which
complicated it so much that I couldn’t make that work and I could
probably go back to that knowing what I know now…but that seems so
clumsy and I thought I could serve the community better in the process
at this point.

Hmm… this could be part of the problem with us trying to provide
assistance.
The way that you are describing what you’re doing indicates to me that
there’s
potentially a lot of context that we, on the list, aren’t seeing. We
definitely
appreciate you trying to distill the problem down for us, but I think
something
might have been lost in the translation.

The thing that struck me as I looked at the api page referenced, is the
notation…
NOTE: Due to backwards compatibility concerns, the collection can?t be
one of hashes. Normally you?d also just keep domain objects, like Active
Records, in there.

I think I have an ‘array’ of hashes which I think is different
than what is cautioned but being the newbie that I am, I am never really
quite certain which is sort of why I published the ‘debug’ at the end of
my last post.

And the debug does help. Unfortunately, what you showed us was a debug
from the
instance variable that you’re passing to :collection. We’ve already
discovered
that variable isn’t changing, which is why accessing it through the
_counter
variable is working.

Your explanation was perfectly clear - provided amplification to the
AWDWR book explanation - if it had worked, the ‘aha’ moment would have
been all encompassing and I would move on (but create the wiki).

As for the need/desirability of a wiki page…I think it’s self evident.

Well, I never said that a Wiki page wouldn’t be helpful, only that I
didn’t see
a need for it. :slight_smile:

The problem is that neither you nor Dave nor a lot of people on this
list can actually see rails through a new users eyes any longer and what
may appear obvious or to be a clear explanation in AWDWR or the api
pages is less clear to a newer user.

That’s probably true, to some extent. However, I, like Mr. Thomas (and
I’m sure,
many others on the list), spend a good portion of our time helping new
users
become more accomplished users. And not just with Rails. So I’m not sure
your
characterization is entirely correct.

Iterating loops within loops over an array of hashes (with hashes in the
hashes) has been a daunting experience.

Um… wow. That would be a daunting experience, even for a very
experienced
Rails developer. That level of nesting is enough to make anyone feel
lost and
frustrated. It’s also one of the hardest things to debug when one
portion of the
process goes awry.

So I started with my best assessment on how to do this and
ultimately ended up trying every conceivable possibility just out of
frustration. Sometimes a parallel explanation using different
terminology to convey the same information clicks.

Agreed. And hopefully, we’re going to get to the bottom of why your
partial
w/collection isn’t working the way partials w/collections are supposed
to work…

-Brian


#20

On Fri, 2006-03-17 at 09:32 -0500, Brian V. Hughes wrote:

I’ve been staying out of this thread, because it looked like plenty of other
people had answered your questions, and you had Dave T. personally helping
you. I didn’t see that I had much to add. But you’re still confused as to the
basic nature of how partials with :collection work…


but you have added much - see below

Thus if my controller code specifically is
:conditions => [ “facility_id = ?”, idx ])
fac_log_test[fac_log_test_counter][:facility][:name]
to read:

fac_log_test[:facility][:name]


which totally makes sense to me - the moment I read this, I said…yeah,
that’s why I could never get it to work. So I changed it and the same
brick wall occurred (you can see that I changed the line per your
suggestion within the error)…

NoMethodError in #
Showing app/views/reports/_fac_log_test.rhtml where line #28 raised:

You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.[]

Extracted source (around line #28):

28:

<%=h
(fac_log_test[:facility][:name]) %>

I have left in all of the thread on this above to provide continuity and
to suggest that I haven’t changed anything else but line #28

which generates an error [2]

Unfortunately, as I stated above, your understanding of this aspect of partials
with :collection is incorrect. The object you reference as :collection => needs
to be an array. That array is then looped over, using the each_with_index method
provided by the Enumerable mixin (for those who care ;). The partial only
receives the array item, not the whole array.


your explanation makes sense and that is how I thought I understood it
and my problem is that it hasn’t worked for me. So at the moment, my
instance variable with the array of hashes is the only thing that is
working and where the variable itself hasn’t worked - and this is the
focus of this entire discussion.

what does work is…
<%=h (@facility_log[fac_log_test_counter][:facility][:name]) %>

which is not how the book describes it at all, ** as I understand it **.

Correct. Here you are simply referencing the instance variable that you
generated so you could pass to the collection. If you were going to do this kind
of referencing, you’re better off putting the loop in the main view template and
skipping partials altogether.


My problem with doing that was that I had another loop in the loop which
complicated it so much that I couldn’t make that work and I could
probably go back to that knowing what I know now…but that seems so
clumsy and I thought I could serve the community better in the process
at this point.

So either my usage is queer, my understanding was wrong or the methodology
suggested in the book isn’t always applicable.

Actually, what the book states is, in fact, correct. Unfortunately, somewhere
along the way, you’re understanding of what the book was saying got muddled. And
you’ve been operating under that mistaken understanding ever since.


agreed

Since there is a complete lack of information about how to iterate using
:partials and :collections on wiki.rubyonrails.org, I am perfectly willing to
provide a healthy write up of the process once I am sure that I understand it
myself.

Actually, I never thought one was needed, but that’s because the AWDWR’s
explanation was just fine. Did you ever look at the API page on partials?
http://api.rubyonrails.org/classes/ActionView/Partials.html


Actually, I hadn’t checked that out and I probably should have. The
explanation is somewhat similar to AWDWR and like most things in the api
(which I wonder if I have been singlehandedly wearing out), is terse and
no examples :wink:

The thing that struck me as I looked at the api page referenced, is the
notation…
NOTE: Due to backwards compatibility concerns, the collection canâ??t be
one of hashes. Normally youâ??d also just keep domain objects, like Active
Records, in there.

I think I have an ‘array’ of hashes which I think is different
than what is cautioned but being the newbie that I am, I am never really
quite certain which is sort of why I published the ‘debug’ at the end of
my last post.

So if anyone has any input into this process or can provide
clarification…including Dave, please feel free to enlighten me and I
promise to pass that knowledge on to the community via the wiki.

Hopefully, I’ve been able to provide some clarification on where your
understanding is off. If not, please ask. Now that I’m in the discussion, I’ll
do my best to help you get over the hump on this.


Your explanation was perfectly clear - provided amplification to the
AWDWR book explanation - if it had worked, the ‘aha’ moment would have
been all encompassing and I would move on (but create the wiki).

As for the need/desirability of a wiki page…I think it’s self evident.
The problem is that neither you nor Dave nor a lot of people on this
list can actually see rails through a new users eyes any longer and what
may appear obvious or to be a clear explanation in AWDWR or the api
pages is less clear to a newer user. Iterating loops within loops over
an array of hashes (with hashes in the hashes) has been a daunting
experience. So I started with my best assessment on how to do this and
ultimately ended up trying every conceivable possibility just out of
frustration. Sometimes a parallel explanation using different
terminology to convey the same information clicks.

Craig