-
-
Save aarongough/835346 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% @searchresults.each do |movie| %> | |
Found: <%= movie.name %> | <%= movie.id %><br /> | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<center><h1>My movies</h1></center> | |
<%= form_tag movies_path, :method => :get, :remote => true do %> | |
<p> | |
<%= search_field_tag :search, params[:search] %> | |
<%= submit_tag "Search", :name => nil %> | |
</p> | |
<% end %> | |
<div id="searchresults"> | |
<% if not @searchresults.nil? %> | |
<%= render @searchresults %> | |
<% end %> | |
</div> | |
<hr> | |
<%= render 'layouts/movies' %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("#searchresults").html("<%= escape_javascript(render(@searchresults)) %>"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MoviesController < ApplicationController | |
def index | |
@title = "My movies" | |
@movies = Movie.all | |
if params[:search] | |
Tmdb.api_key = "XXX" | |
@searchresults = TmdbMovie.find(:title => params[:search], :expand_results => false) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment