Created
June 5, 2012 21:19
-
-
Save dmuneras/2878057 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
Method | |
def self.search(city,movie,date) | |
url = "http://www.cinecolombia.com/movie.aspx?idciudad=#{city}&idpelicula=#{movie}&caracteristicas=987&fecha=#{date}" | |
respond = Hpricot(open(url)) | |
result = (respond/"div#Subt/div/div#parrilla") | |
return result.inner_html.gsub(/\s+/, " ").strip | |
end | |
Controller | |
def search | |
respond_to do |format| | |
format.js{ | |
logger.info "========> datos a evaluar : ciudad: #{params[:cities]}, movie: #{params[:movies]}" | |
@search_result = Searcher.search(params[:cities] , params[:movies] , params[:date]) | |
logger.info "========> Respuesta cine colombia: #{@search_result}" | |
} | |
end | |
View | |
<% if @search_result.blank? %> | |
$('#respond').html("Lo sentimos pero no se encontraron opciones"); | |
<% else %> | |
$('#respond').html("<%= j @search_result %>"); | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment