Forum: Ruby on Rails undefined method and auto_complete

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C1e5a9e9344b6d31b9df7303e6dc378a?d=identicon&s=25 Craig White (Guest)
on 2006-03-12 19: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

  <td><p><label>Client</label><br/>
    <%= text_field_with_auto_complete :placement, :clwholename, {} %>
    </p>
  </td>

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)
  end

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

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]
  end

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

Craig
This topic is locked and can not be replied to.