Forum: Ruby on Rails undefined method and auto_complete

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Craig W. (Guest)
on 2006-03-12 20:51
(Received via mailing list)
pulling my hair out on this because I don't understand...

I have 2 methods/actions in the same 'placements' controller that I am
concerned with...

find, works properly...

view code from find.rhtml

    <%= text_field_with_auto_complete :placement, :clwholename, {} %>

new, which throws me an error...
undefined method `clwholename' for #<Placement:0xb78e0dc0>

which has the same exact view code as above...

clwholename is an aggregation defined in the Client class which combines
the client first_name, middle_initial, last_name

the controller code for new and find don't seem to impact this...

  def find
    @placements = Placement.find(:all)
    @clients = Client.find(:all)

  def new
    @placement =
    @client = Client.find(:all)

but just to make sure, I added the 2 lines in the 'find' definition,
into the 'new' definition and the result is the same.

and I do have the method in my controller that should works for 'find'
but not 'new'...

  def auto_complete_for_placement_clwholename
    auto_complete_responder_for_clients params[:placement][:clwholename]

Why would 'find' work but not 'new' ?

This topic is locked and can not be replied to.