# rendering partial problem.

**URL:** <https://discuss.rubyonrails.org/t/rendering-partial-problem/62943>\
**Category:** rubyonrails-talk\
**Created:** [February 22, 2012, 7:02pm UTC](https://discuss.rubyonrails.org/t/rendering-partial-problem/62943 "2012-02-22T19:02:08Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![11155](https://avatars.discourse-cdn.com/v4/letter/1/d26b3c/32.png) [@11155](https://discuss.rubyonrails.org/u/11155)\
**Post date:** [February 22, 2012, 7:02pm UTC](https://discuss.rubyonrails.org/t/rendering-partial-problem/62943/1 "2012-02-22T19:02:08Z")

</div>

Can anyone help me?

I have a problem that when I click on the search button I get the following error message:

ActionView::MissingTemplate in Searches#show

Showing C:/finalproject/app/views/searches/show.html.erb where line #3 raised:

Missing partial games/game with {:handlers=\>[:erb, :builder, :coffee], :formats=\>[:html], :locale=\>[:en, :en]}. Searched in: &nbsp;&nbsp;\* "C:/finalproject/app/views" &nbsp;&nbsp;\* "C:/Ruby/lib/ruby/gems/1.9.1/gems/kaminari-0.13.0/app/views"

I have the following in my show.html.erb:

\<h2\>Search\</h2\>

\<%= render :partial =\> @search.games%\>

Any ideas?

Thanks R.Patrick

---

<div class="post-metadata">

**Author:** ![Javier\_Quarite](https://avatars.discourse-cdn.com/v4/letter/j/848f3c/32.png) [@Javier\_Quarite](https://discuss.rubyonrails.org/u/Javier_Quarite)\
**Post date:** [February 22, 2012, 7:07pm UTC](https://discuss.rubyonrails.org/t/rendering-partial-problem/62943/2 "2012-02-22T19:07:27Z")

</div>

What do you have in your controller? Searches#show

Javier Q

---

<div class="post-metadata">

**Author:** ![11155](https://avatars.discourse-cdn.com/v4/letter/1/d26b3c/32.png) [@11155](https://discuss.rubyonrails.org/u/11155)\
**Post date:** [February 22, 2012, 7:15pm UTC](https://discuss.rubyonrails.org/t/rendering-partial-problem/62943/3 "2012-02-22T19:15:46Z")

</div>

Javier Quarite wrote in post #1048286:

> > Missing partial games/game with {:handlers=\>[:erb, :builder, :coffee],
> > 
> > Any ideas?
> > 
> > Thanks R.Patrick
> 
> What do you have in your controller? Searches#show
> 
> Javier Q

class SearchesController \< ApplicationController &nbsp;&nbsp;def new &nbsp;&nbsp;&nbsp;&nbsp;@search = Search.new &nbsp;&nbsp;end

&nbsp;&nbsp;def create &nbsp;&nbsp;&nbsp;&nbsp;@search = Search.new(params[:search]) &nbsp;&nbsp;&nbsp;&nbsp;if @search.save &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;redirect\_to @search, :notice =\> "Successfully created search." &nbsp;&nbsp;&nbsp;&nbsp;else &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;render :action =\> 'new' &nbsp;&nbsp;&nbsp;&nbsp;end &nbsp;&nbsp;end

&nbsp;&nbsp;def show &nbsp;&nbsp;&nbsp;&nbsp;@search = Search.find(params[:id]) &nbsp;&nbsp;end end

---

<div class="post-metadata">

**Author:** ![Javier\_Quarite](https://avatars.discourse-cdn.com/v4/letter/j/848f3c/32.png) [@Javier\_Quarite](https://discuss.rubyonrails.org/u/Javier_Quarite)\
**Post date:** [February 22, 2012, 7:21pm UTC](https://discuss.rubyonrails.org/t/rendering-partial-problem/62943/4 "2012-02-22T19:21:13Z")

</div>

If you see the log, the you’ll see a query ( the result of Search.find(params[:id]),

after that you haven’t told rails what to do with it, so as you see on you create method

you’re being redirect to “@search” (that’s a sort of abreviation of what you have on your routes.rb file)

You may want to do a respond\_to block, try searching that on rails guide or try this tutorial

[http://ruby.railstutorial.org/](http://ruby.railstutorial.org/)

Javier Q

---

<div class="post-metadata">

**Author:** ![Valery\_Kvon](https://avatars.discourse-cdn.com/v4/letter/v/dbc845/32.png) [@Valery\_Kvon](https://discuss.rubyonrails.org/u/Valery_Kvon)\
**Post date:** [February 22, 2012, 7:42pm UTC](https://discuss.rubyonrails.org/t/rendering-partial-problem/62943/5 "2012-02-22T19:42:17Z")

</div>

> Showing C:/finalproject/app/views/searches/show.html.erb where line #3 raised:
> 
> Missing partial games/game with {:handlers=\>[:erb, :builder, :coffee],

What about Missing partial games/game (/views/games/\_game.html.erb) ? 🙂

---

<div class="post-metadata">

**Author:** ![11155](https://avatars.discourse-cdn.com/v4/letter/1/d26b3c/32.png) [@11155](https://discuss.rubyonrails.org/u/11155)\
**Post date:** [February 22, 2012, 8:16pm UTC](https://discuss.rubyonrails.org/t/rendering-partial-problem/62943/6 "2012-02-22T20:16:18Z")

</div>

Valery Kvon wrote in post #1048293:

> > Showing C:/finalproject/app/views/searches/show.html.erb where line #3 raised:
> > 
> > Missing partial games/game with {:handlers=\>[:erb, :builder, :coffee],
> 
> What about Missing partial games/game (/views/games/\_game.html.erb) ? 🙂

in my games view folder I have the following:

index new show edit \_form

I don't really understand the missing partial part. I have already uploaded my search\_controller and show.html classes. I have below my search.rb model file if it is of any use:

class Search \< ActiveRecord::Base &nbsp;&nbsp;attr\_accessible :game\_name, :console, :genre

&nbsp;&nbsp;def games &nbsp;&nbsp;&nbsp;&nbsp;@games ||= find\_games &nbsp;&nbsp;end

&nbsp;&nbsp;private

&nbsp;&nbsp;def find\_games &nbsp;&nbsp;&nbsp;&nbsp;Game.find(:all, :conditions =\> conditions) &nbsp;&nbsp;end

&nbsp;&nbsp;def name\_conditions &nbsp;&nbsp;&nbsp;&nbsp;["game\_name LIKE ?", "%#{game\_name}%"] unless game\_name.blank? &nbsp;&nbsp;end

&nbsp;&nbsp;def console\_conditions &nbsp;&nbsp;&nbsp;&nbsp;["console LIKE ?", "%#{console}"] unless console.blank? &nbsp;&nbsp;end

&nbsp;&nbsp;def genre\_conditions &nbsp;&nbsp;&nbsp;&nbsp;["genre LIKE ?", "%#{genre}"] unless genre.blank? &nbsp;&nbsp;end

&nbsp;&nbsp;def conditions &nbsp;&nbsp;[conditions\_clauses.join(' AND '), \*conditions\_options] end

def conditions\_clauses &nbsp;&nbsp;conditions\_parts.map { |condition| condition.first } end

def conditions\_options &nbsp;&nbsp;conditions\_parts.map { |condition| condition[1..-1] }.flatten end

def conditions\_parts &nbsp;&nbsp;private\_methods(false).grep(/\_conditions$/).map { |m| send(m) }.compact end

end

Hope this helps.

---

<div class="post-metadata">

**Author:** ![Valery\_Kvon](https://avatars.discourse-cdn.com/v4/letter/v/dbc845/32.png) [@Valery\_Kvon](https://discuss.rubyonrails.org/u/Valery_Kvon)\
**Post date:** [February 22, 2012, 8:55pm UTC](https://discuss.rubyonrails.org/t/rendering-partial-problem/62943/7 "2012-02-22T20:55:20Z")

</div>

\<%= render @search.games %\>

means you have partial file:

---- /app/views/games/\_game.erb.html

hello world!, i’m \<%= game %\> instance!

---

<div class="post-metadata">

**Author:** ![11155](https://avatars.discourse-cdn.com/v4/letter/1/d26b3c/32.png) [@11155](https://discuss.rubyonrails.org/u/11155)\
**Post date:** [February 22, 2012, 9:05pm UTC](https://discuss.rubyonrails.org/t/rendering-partial-problem/62943/8 "2012-02-22T21:05:33Z")

</div>

> \<%= render @search.games %\>
> 
> means you have partial file:
> 
> ---- /app/views/games/\_game.erb.html
> 
> hello world!, i'm \<%= game %\> instance!
> 
> ----
> 
> [Layouts and Rendering in Rails — Ruby on Rails Guides](http://guides.rubyonrails.org/layouts_and_rendering.html)
> 
> If you have an instance of a model to render into a partial, you can use a shorthand syntax:
> 
> \<%= render @customer %\> Assuming that the @customer instance variable contains an instance of the Customer model, this will use \_customer.html.erb to render it and will pass the local variable customer into the partial which will refer to the @customer instance variable in the parent view.

I literally just solved it before you posted this 🙂 thanks for all the help, after reading a previous reply to my post it just clicked. Thanks all.
