I have an index method with a respond_to block that produces this
error:
NoMethodError (You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.accepts):
The show method has the same respond_to block but doesn’t error out.
If I take the respond_to block out of the index method, it works.
If I give index params[:keywords] I get this error:
Amazon::Search::Request::TypeError (non-existent/unimplemented search
type: accepts):
Any advice?
Thanks,
–Dean
def index
unless params[:keywords].nil?
@books = Array.new
request = Amazon::Search::Request.new( DEV_TOKEN, ASSOCIATE_ID,
‘us’ )
response = request.keyword_search( params[:keywords] ) do |
product|
@books.push( Book.new( ) )
end
end
respond_to do |f|
f.html { }
f.js { }
end
end
def show
@book = Book.find(params[:id])
respond_to do |f|
f.html { }
f.xml { render :xml => @book.to_xml }
f.js { }
end
end