# Serious noob question. Any help would be great

**URL:** <https://www.ruby-forum.com/t/serious-noob-question-any-help-would-be-great/96684>\
**Category:** Rails\
**Created:** [June 30, 2006, 8:36pm UTC](https://www.ruby-forum.com/t/serious-noob-question-any-help-would-be-great/96684 "2006-06-30T20:36:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ds\_10](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@ds\_10](https://www.ruby-forum.com/u/ds_10)\
**Post date:** [June 30, 2006, 8:36pm UTC](https://www.ruby-forum.com/t/serious-noob-question-any-help-would-be-great/96684/1 "2006-06-30T20:36:09Z")

</div>

Hi All,

I’m working on building an app that can log and edit phone call  
information. I’ve got the creating and editing parting working great,  
and I’ve started an attempt to add searching. I can’t seem to figure  
out how to get an [:id] parameter from a form and passed between two  
controller methods. Right now I have a web page with a single text  
field in it and a button. I want to be able to type in a valid record  
ID into the text field, hit the button and be taken to the edit page for  
the record with that ID. I realize this should be dead simple, but I  
haven’t figured out a way to get it to work. I keep getting an error:  
"Unable to find without an ID. Hopefully someone here can tell me where  
I’ve gone astray. Here is the code I have right now:

##controller.rb  
def edit  
@support\_call = SupportCall.find(params[:id])  
end

def find  
end

##find.rhtml

\<%= start\_form\_tag :action =\> “edit”, :id =\> params[:id] %\>

\<%= text\_field “support\_call”, “id” %\>  
\<%= submit\_tag “Find It!” %\>  
\<%= end\_form\_tag %\>

---

<div class="post-metadata">

**Author:** ![ds\_10](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@ds\_10](https://www.ruby-forum.com/u/ds_10)\
**Post date:** [June 30, 2006, 8:56pm UTC](https://www.ruby-forum.com/t/serious-noob-question-any-help-would-be-great/96684/2 "2006-06-30T20:56:17Z")

</div>

On Jun 30, 2006, at 2:36 PM, ds\_10 wrote:

> the record with that ID. I realize this should be dead simple, but I
> 
> def find  
> @support\_call = SupportCall.new  
> \<%= submit\_tag “Find It!” %\>  
> \<%= end\_form\_tag %\>

Your text\_field helper is trying to give the form an initial value  
from @support\_call.id

The SupportCall.new just gives you an in-memory object of your  
model. If you can’t create them first, then you won’t ever be able  
to find them 😉

-Rob

---

<div class="post-metadata">

**Author:** ![ds\_10](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@ds\_10](https://www.ruby-forum.com/u/ds_10)\
**Post date:** [June 30, 2006, 9:02pm UTC](https://www.ruby-forum.com/t/serious-noob-question-any-help-would-be-great/96684/3 "2006-06-30T21:02:30Z")

</div>

ds\_10 wrote:

> 

def edit  
@support\_call = SupportCall.find(params[:support\_call][:id])  
end

---

<div class="post-metadata">

**Author:** ![ds\_10](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@ds\_10](https://www.ruby-forum.com/u/ds_10)\
**Post date:** [June 30, 2006, 9:55pm UTC](https://www.ruby-forum.com/t/serious-noob-question-any-help-would-be-great/96684/4 "2006-06-30T21:55:32Z")

</div>

Wow! You guys were really fast!. Thanks everybody. Your suggestions got  
everything working correctly. It’s great to know that a helpful  
community like this is available. I’ll try to have a more challenging  
problem next time I need help 🙂

Thanks again,

Dan

---

<div class="post-metadata">

**Author:** ![ds\_10](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@ds\_10](https://www.ruby-forum.com/u/ds_10)\
**Post date:** [June 30, 2006, 9:12pm UTC](https://www.ruby-forum.com/t/serious-noob-question-any-help-would-be-great/96684/5 "2006-06-30T21:12:06Z")

</div>

yeah, and I’m not sure you need this

> \<%= start\_form\_tag :action =\> “edit”, :id =\> params[:id] %\>

You can use this  
\<%= start\_form\_tag :action =\> “edit”%\>

When the user clicks the button the browser will automatically wrap up  
any  
forms you have and post them back to the action you’ve defined. (In this  
case “edit”)

In the edit action in your controller you can pull out the data from  
this  
form like  
params[:support\_call][:id]

As the previous email illustrates.

-Brian
