Thanks Frederick for looking at my issue.

Apparently I don't have a full understanding of how the AJAX request
interacts with (or I guess doesn't interact with) the form_for...
So is the basic idea of what I'm attempting completely wrong or is
there some slight modification I can do to pull it off?
Basically, I have a form where I want to create a new listing record -
but I want the fields to be restricted to values stored in the
automodels Model in the database (and the model drop-down to be
filtered based on the make selected).
>From what I've been reading, the best way to do the "dynamic select"
is using AJAX.  However, I guess the collection_selects are never
inside a form in the examples I've read?

I'm open to any suggestions from the experts here - even if it means
overhauling the whole thing... :-)

On Aug 11, 3:54 am, Frederick Cheung <[email protected]>
wrote:
> On Aug 11, 2:50 am, Mark Thomas <[email protected]> wrote:
>
> > Hello -
>
> > ActionView::TemplateError (undefined local variable or method `f' for
> > #<ActionView::Base:0xb6e7b2f4>) on line #1 of app/views/listings/
> > _automodels.html.erb:
> > <%= f.collection_select :model, @automodels, :model, :model, {:prompt
> > => "-Select a Make First-"} %>
>
> > This leads me to believe that the "f" variable the rest of the fields
> > in the form_for are using is not available to the newly-replaced
> > "collection_select", but I'm not sure why?
>
> Because that f referred to a form builder object created by form_for.
> You're in a different scope to when you rendered the original form, in
> a different request, with a different instance of the controller,
> possibly on a different mongrel or even a different server. The form
> builder isn't going to magically appear.
>
> Fred
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to