Sunday, March 13, 2011

[Rails] undefined method `model_name in partial .. passing an Array as a collection

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 ?

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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate