I solved it this way instead:

<% entity.errors.each do |array| %>
            <% array.each do |msg| %>
                <li><%= msg %></li>
            <% end %>
<% end %>

But thanks for the suggestion to concatenate via join.



On Dec 29, 5:25 am, Alex Coles <[email protected]> wrote:
> On Thu, Dec 29, 2011 at 5:09 AM, Neil Chaudhuri <[email protected]> wrote:
> > So I have an errors partial to print the contents of the errors
> > collection in an entity as follows:
>
> > <ul>
> >        <% entity.errors.each do |msg| %>
> >            <li><%= msg %></li>
> >        <% end %>
> > </ul>
>
> > However, I am getting this: ["Please provide a name for this
> > entity."]. As you might guess, I just want the message, not the
> > collection within the collection.
>
> > Although I am new to Ruby and Rails, I have managed to figure out how
> > to iterate into the "inner" collection to print out the String I want.
> > However, is there a "cleaner" way to get at that information within a
> > template?
>
> > Thanks.
>
> First off:
>
> You've posted several messages in the last couple days, yet not
> reported back on the suggestions that have been provided. It's common
> mailing list etiquette to do so. Communication should be two-way. It
> helps both the maintainers and others in the DataMapper community to
> have feedback, and to know if the proposed solutions have been of use
> to you.
>
> Why not just use Array#join? In other words:
>   msg.join(',')
>
> Alex

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to