Jin Lee
2006-Apr-27 20:54 UTC
[Rails] text_field_with_auto_complete - NoMethodError in the model
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
