Skip to content

Instantly share code, notes, and snippets.

@Awea
Created April 10, 2013 20:31
Show Gist options
  • Save Awea/5358182 to your computer and use it in GitHub Desktop.
Save Awea/5358182 to your computer and use it in GitHub Desktop.
Nokogiri wtf
source 'https://rubygems.org'
gem 'rails', '3.2.13'
gem 'thin'
gem 'mysql2'
gem 'slim'
gem 'foreman'
# Model easing
gem 'active_attr'
# Md processing
gem 'redcarpet'
# background processing and autoscaling
gem 'sidekiq'
gem 'autoscaler'
# image processing
gem 'image_size'
gem 'carrierwave'
gem 'fog'
gem 'sinatra', '~> 1.2', :require => 'sinatra/base'
# cache
gem 'rack-cache', :require => 'rack/cache'
gem 'dalli'
# parser
gem 'nokogiri'
# Api interaction
gem 'rest-client'
# Pub/Sub
gem 'private_pub'
group :development, :test do
gem 'dotenv'
# Generators
gem 'slim-rails'
gem 'rails3-generators'
# Better debugging
gem 'better_errors'
gem 'binding_of_caller'#, "~> 0.6.9.pre2"
gem 'pry-rails'
gem 'awesome_print'
gem 'meta_request', '0.2.1'
# Test
gem 'factory_girl_rails'
gem 'rspec-rails'
gem 'database_cleaner'
gem 'faker'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
gem 'compass-rails'
end
gem 'jquery-rails'
class SitesController < ApplicationController
def show
@site = Site.find(params[:id])
@with_nokogiri = Nokogiri::HTML(open('http://www.femmeactuelle.fr/').read).to_html
@without_nokogiri = open('http://www.femmeactuelle.fr/').read
if params.has_key? :nokogiri
render text: @with_nokogiri, layout: false
else
render text: @without_nokogiri, layout: false
end
#render layout: false
end
end
@BGuimberteau
Copy link

la ligne 5 à remplacer par @with_nokogiri = open("http://www.femmeactuelle.fr/") { |f| Hpricot(f) }

Si tu utilises hpricot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment