Skip to content

Instantly share code, notes, and snippets.

@dmuneras
Created June 5, 2012 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmuneras/2878057 to your computer and use it in GitHub Desktop.
Save dmuneras/2878057 to your computer and use it in GitHub Desktop.
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