# Model.find(:id) and model.find(:all) giving different result

**URL:** <https://www.ruby-forum.com/t/model-find-id-and-model-find-all-giving-different-result/177907>\
**Category:** Rails\
**Created:** [October 26, 2009, 4:20pm UTC](https://www.ruby-forum.com/t/model-find-id-and-model-find-all-giving-different-result/177907 "2009-10-26T16:20:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mitch\_newbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea5d25/32.png) [@mitch\_newbie](https://www.ruby-forum.com/u/mitch_newbie)\
**Post date:** [October 26, 2009, 4:20pm UTC](https://www.ruby-forum.com/t/model-find-id-and-model-find-all-giving-different-result/177907/1 "2009-10-26T16:20:26Z")

</div>

I have the following code that works very well

@manufacturer = Manufacturer.find\_manufacturer(params[:id])

which produces the following SQL:

SELECT \* FROM `manufacturers` WHERE (`manufacturers`.`id` = 4) #Here  
params[:id] =4

ON my view I can access the fields using

@manufacturer.field\_name

However when I do the following

@manufacturer = Manufacturer.find(:all, :conditions =\> {:id =\>  
params[:id]})

Which produces the same SQL as above:

SELECT \* FROM `manufacturers` WHERE (`manufacturers`.`id` = 4) #Here  
params[:id] =4

I get the following error on my view:

NoMethodError in Public\_manufacturers#show\_manufacturer\_details

Showing  
app/views/public\_manufacturers/show\_manufacturer\_details.html.erb where  
line #4 raised:

undefined method `logo’ for #Array:0x26e4838

Why is this happening and how can I solve it?

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![mitch\_newbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea5d25/32.png) [@mitch\_newbie](https://www.ruby-forum.com/u/mitch_newbie)\
**Post date:** [October 26, 2009, 4:26pm UTC](https://www.ruby-forum.com/t/model-find-id-and-model-find-all-giving-different-result/177907/2 "2009-10-26T16:26:33Z")

</div>

find(:all, …) returns an array.

find(:first, …), or equivalently, find\_manufacturer(some\_id) returns  
a single item.

try:

@manufacturers = Manufacturer.find(:all, :conditions =\> {:id =\>  
params[:id]})

@manufacturers[0].show\_manufacturer\_details.

–wpd
