def show @search = Search.find(params[:id])
end
end
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
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
attr_accessible :game_name, :console, :genre
def games @games ||= find_games
end
private
def find_games
Game.find(:all, :conditions => conditions)
end
def name_conditions
[“games.game_name LIKE ?”, “%#{game_name}%”] unless game_name.blank?
end
def console_conditions
[“games.console LIKE ?”, “%#{console}”] unless console.blank?
end
def genre_conditions
[“games.genre LIKE ?”, “%#{genre}”] unless genre.blank?
end
def conditions
[conditions_clauses.join(’ AND '), *conditions_options]
end
def conditions_clauses
conditions_parts.map { |condition| condition.first }
end
def conditions_options
conditions_parts.map { |condition| condition[1…-1] }.flatten
end
def conditions_parts
private_methods(false).grep(/_conditions$/).map { |m| send(m)
}.compact
end
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.
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:
<%= render @search.games %>
means you have partial file:
---- /app/views/games/_game.erb.html
hello world!, i’m <%= game %> instance!
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.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.