Forum: Ruby on Rails text_field_with_auto_complete - NoMethodError in the model

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.
E2489efc6ec10ec818b71965909ea109?d=identicon&s=25 Jin Lee (Guest)
on 2006-04-27 22:56
(Received via mailing list)
Hey guys,

I have a text_field_with_auto_complete that looks like this:

<%= text_field_with_auto_complete ("service_request", "req_name",
{"size"=>40}) %>

which goes to this in the controller:

def auto_complete_for_service_request_req_name
    auto_complete_responder_for_investigators
params[:service_request][:req_name]
end

auto_complete_responder_for_investigators renders the partial after
doing a query.

When I load the page, I get this:

NoMethodError in   Service_request#new

Showing app/views/service_request/new.rhtml where line #12 raised:
undefined method `req_name' for #<ServiceRequest:0x7802a50>

that's because req_name is not a field in the table. So in my
ServiceRequest.rb model, I have this:

validates_presence_of :req_name

Still not working... am I missing something here? Any help is
appreciated!

Thanks,
Jin
This topic is locked and can not be replied to.