# Returned values and consequent usage

**URL:** <https://www.ruby-forum.com/t/returned-values-and-consequent-usage/98418>\
**Category:** Rails\
**Created:** [January 29, 2006, 8:42am UTC](https://www.ruby-forum.com/t/returned-values-and-consequent-usage/98418 "2006-01-29T08:42:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [January 29, 2006, 8:42am UTC](https://www.ruby-forum.com/t/returned-values-and-consequent-usage/98418/1 "2006-01-29T08:42:21Z")

</div>

I think I can have finally reduced my problem to something somebody can  
help me with.

I am using auto\_complete…

specifically the form command is…

\<%= text\_area\_auto\_complete\_for :case\_manager :name %\>

I need to use the value derived here in my controller…

If I use…

cm = CaseManager.find(:first, :conditions =\> “name = ‘Thomas E Dewey’”)

it works. I need to substitute the value derived from auto\_complete  
above for Thomas E Dewey…

cm = CaseManager.find(:first, :conditions =\> “name = name”)  
the lookup will always return record #1

cm = CaseManager.find(:first, :conditions =\> “name = :name”)  
cm = CaseManager.find(:first, :conditions =\> “name = @name”)  
cm = CaseManager.find(:first, :conditions =\> “name = case\_manager\_name”)  
all give me errors syntax or operator or run-time errors

How do I get the value derived from auto\_complete into a find command?

Craig

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [January 29, 2006, 10:09am UTC](https://www.ruby-forum.com/t/returned-values-and-consequent-usage/98418/2 "2006-01-29T10:09:44Z")

</div>

Are you referring to when it sends it back to the server via a form  
post?

Not sure exactly what you want but try:

CaseManager.find(:first, :conditions =\> [“name = ?”, case\_manager.name])

You can always fall back to the params:

CaseManager.find(:first, :conditions =\> [“name = ?”,  
params[case\_manager][name]])

Again, not sure where you are trying to “find” something using the value  
of  
the auto\_complete field. Or are you trying to use this to populate the  
auto\_complete field?

Bob S.  
[http://www.railtie.net/](http://www.railtie.net/)
