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

2011-03-13 Thread Frederick Cheung
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 =

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

2011-03-13 Thread Erwin
Thanks fred.. I tried with object but same error.. it seems model_name_from_record_or_class is needed when using collection I may have to change the partial rendering ... ? -- trace activemodel (3.0.4) lib/active_model/naming.rb:94:in `model_name_from_record_or_class' activemodel (3.0.4)

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

2011-03-13 Thread Erwin
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

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

2011-03-13 Thread Frederick Cheung
On Mar 13, 1:28 pm, Erwin yves_duf...@mac.com wrote: 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 =

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

2011-03-13 Thread Erwin
thanks you confirm it .. I noticed it as I change my test code using the array as the collection it's fine now ... using content_tag obvious thing doesn't appears at first glance !! On 13 mar, 15:12, Frederick Cheung frederick.che...@gmail.com wrote: On Mar 13, 1:28 pm, Erwin