# Error, in my store provider

**URL:** <https://www.ruby-forum.com/t/error-in-my-store-provider/61803>\
**Category:** Rails\
**Created:** [May 27, 2006, 6:26pm UTC](https://www.ruby-forum.com/t/error-in-my-store-provider/61803 "2006-05-27T18:26:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![coward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/aeb1de/32.png) [@coward](https://www.ruby-forum.com/u/coward)\
**Post date:** [May 27, 2006, 6:26pm UTC](https://www.ruby-forum.com/t/error-in-my-store-provider/61803/1 "2006-05-27T18:26:22Z")

</div>

Let me explain the subject title, store provider is Hackey, he’s a NPC  
that sells items to my users.

# Welcome to Hackey's!

### Catalog
\<% for items in @items -%\> \<% temp12 = Item.find(items.item\_id) -%\> \<% end -%\>

| \<%= @temp12.name %\> | \<%= @temp12.add\_atk %\> | \<%= @temp12.add\_def %\> | \<%= @temp12.sell %\> |

It doesn't like Item.find(items.item\_id) BTW: the table is called hackey, so maybe it dosn't like the items in @items but, I don't know what to put, how does it plurlize that? in my model I set set\_table\_name "hackey".

---

<div class="post-metadata">

**Author:** ![coward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/aeb1de/32.png) [@coward](https://www.ruby-forum.com/u/coward)\
**Post date:** [May 28, 2006, 5:11pm UTC](https://www.ruby-forum.com/t/error-in-my-store-provider/61803/2 "2006-05-28T17:11:50Z")

</div>

Okay 1 more q. How do I delete that row?

---

<div class="post-metadata">

**Author:** ![coward](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/aeb1de/32.png) [@coward](https://www.ruby-forum.com/u/coward)\
**Post date:** [May 27, 2006, 6:44pm UTC](https://www.ruby-forum.com/t/error-in-my-store-provider/61803/3 "2006-05-27T18:44:46Z")

</div>

I’m not sure exactly whether Item.find(items.item\_id) isn’t working - I  
would check /logs/development.log to see what SQL is being generated.

In your code, you assign the result of Item.find to “temp12” but later  
reference it as “@temp12” - these are separate variables, and you should  
drop the “@” in the later references.

I’ve also got a couple more suggestions - first, you can use Item.find  
to  
return a collection of items, so that you don’t have to call Item.find  
for  
every iteration of your loop. Also, it might be easier/make more sense  
to  
use the rails convention of having “id” be the name of your primary  
field  
column, rather than “item\_id”. Finally, “temp12” is a pretty  
undescriptive  
name, you can probably come up with a better one 🙂

Daniel
