to avoid being confused with 'object' litteral .. I modified the test
code as following :

#lockers
        %table#items
                = render :partial => 'item',  :collection => ['foo', 'bar', 
'baz']

and the _item  partial

= content_tag_for(:tr, item) do
        %td= item

this time , the error is :   undefined method `model_name' for
String:Class

I believe there is something wrong with the content_tag_for...



On 13 mar, 13:34, Frederick Cheung <frederick.che...@gmail.com> wrote:
> On Mar 13, 11:42 am, Erwin <yves_duf...@mac.com> wrote:
>
>
>
>
>
>
>
>
>
> > In the controller , I am passing an Array as a collection
> >  @objects = ["item1", "item2", "item3", "item4"]
>
> > in the view I wrote
> > %table#objects
> >     = render :partial => 'object',  :collection => @objects
>
> > and in my partial  _object.html
> > = content_tag_for(:tr, @object) do
> >         %td= @object
> >         %td= link_to........
>
> > but I got an error :  undefined method `model_name' for NilClass:Class
> > for the #object in the content_tag
>
> > @object is not not a class..... (yet)  I  just to want to test on an
> > Array of string ....  anyway of doing such thing ?
>
> @object isn't set - you should be using object (since that's what
> render will be filling with the items from @objects
>
> Fred
>
>
>
>
>
>
>
>
>
> > thanks for your feedback

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to