Zhuhao Wang wrote:
> Bharat Ruparel wrote:
>> The following rails 2.3.x code is not working in rails 3 beta 4:
>>
>> def
>> render_crud_table(obj,controller_name,columns,search_fields_array,status_array,actions)
>> render :partial => 'shared/crud_maint_table', :object => obj,
>> :locals => {:controller_name => controller_name, :columns =>
>> columns, :search_fields_array => search_fields_array, :status_array =>
>> status_array, :actions => actions}
>> end
>>
>> The partial _crud_maint_table in the shared folder has this code
>> snippet:
>>
>> ...
>> - crud_maint_table.each do |a_rec|
>> %tr{ :class => cycle("odd","even") }
>> - columns.each_with_index do |col, i|
>> %td{ :class => (i == 0 ? 'first' : nil) }
>> ...
>>
>> See the crud_maint_table.each loop? That works in rails 2.3.x but not
>> in rails 3.
>> Please advise.
>> thanks.
>> Bharat
>
>
> Well,I met the same problem.
> I had some debug, it seems that rails treat :object as :collection, so
> the crud_maint_table actually is the first element of the array obj.
> I'm not sure it's a bug or sth changed since 3 and I haven't found any
> solution
When I tried to use :locals, there are some strange text:
#<Tutor:0xd3065c0>#<Tutor:0xd2e32b0>#<Tutor:0xd2e3250>#<Tutor:0xd2e3118>#<Tutor:0xd2e30b8>#<Tutor:0xd2e3058>#<Tutor:0xd2e2ff8>#<Tutor:0xd2e2f98>#<Tutor:0xd2e2f38>#<Tutor:0xd2e2ea8>#<Tutor:0xd2e2d40>#<Tutor:0xd2e2cc8>#<Tutor:0xd2e2c08>#<Tutor:0xd2e2b78>#<Tutor:0xd2e2b18>
before the content of the partial ,seems like the ID of the elements of
the array I passed in.......can't get rid of it.............
--
Posted via http://www.ruby-forum.com/.
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.