Can you render partial with collection non-existent rows?


#1

Hi,

I’m trying to create a blank input form with a header and many item
lines. I would like to build the item lines dynamically ie not hard code
up to 100 lines into my form. Is it possible to use render partial with
a dummy collection for this? When I try to render with @item_lines
holding 1 object created with .new, I get:

ActionView::TemplateError (undefined method `each_with_index’ for
#Item:0x24c98b8) on line #22 of app/views/receipts/new.rhtml:
21:
22: <%= render :partial => ‘item_line’, :collection => @item_lines
%>

If @item_lines holds objects read from the database, the page renders
OK. Am I approaching this problem the wrong way?

-thanks
Lindsay


#2

I work in a Windows centric environment where everything is
authenticated to Active Directory. I have Apache authenticating access
to Rails 1.0 apps using mod_sspi and pass-thru NTLM authentication.

It works fine for basic page loads in IE and also IE seems to pass the
NTLM token with each AJAX call as well so IE works fine.

Firefox however works fine and passes NTLM for basic page loads, but
won’t pass NTLM authentication for AJAX calls and subsequently asks the
user to log in when they hit something using an auto_complete_for.

Is there a workaround for this that any of you have discovered to either
force Firefox to NTLM authenticate AJAX calls or to work around this in
Rails?

Thanks,
Charles L.


#3

Charels, you might want to re-post the message above.