Displaying 20 results from an estimated 6000 matches similar to: "How to scrape a page without knowing its html structure"
2009 Dec 23
4
html parser / assertions in a model
I am using http.get in a model to parse html code returned from a Oracle
server.
My first try was to use assertions (assert and assert_select) to test
and parse the html code. But I have problems including the methods in
the model. Have tried both "include" and copy/paste to get assertion
methods into my model. Works as a model, but I get load errors when I am
using the model from a
2009 Oct 13
9
Nokogiri: to_s WITHOUT html surrounding's tags?
Hi all
n = Nokogiri::HTML("<h1>H1</h1>")
n.to_s
# => <!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"
\"http://www.w3.org/TR/REC-html40/loose.dtd\">\n<html><body><h1>H1</h1></body></html>
Is there a method that only outputs the stuff I''ve read, and not the
whole valid XHTML stuff?
2009 Oct 12
15
We're sorry, but something went wrong on Tomcat
I am using JRuby and I have to deploy on Tomcat. My web app is working
fine in the dev envirmonment, with Mongel, but when I deploy on Tomcat
I get "We''re sorry, but something went wrong on Tomcat".
The problem is that production.log only shows:
# Logfile created on Mon Oct 12 12:54:36 +0100 2009-bash-3.00
The file permission and directory are 777.
Any idea how I can
2010 Aug 14
10
Redirecting after logging in
Hey everybody,
I''m trying to make an example of a small networking site, and when I log
in a user, it should redirect and show his profile, but I get the
following error:
NoMethodError in User#index
Showing app/views/user/index.html.erb where line #5 raised:
undefined method `screen_name'' for nil:NilClass
Extracted source (around line #5):
2: Your basic information
3:
2010 Mar 07
8
Parsing XML file with no style info with Hpricot
Hello,
I''ve been trying for hours to parse an XML using Hpricot. Usually it''s
not a problem. Here''s my simple code:
#This works and outputs the proper xml data
@url1 = ''http://www.sportingnews.com/stories/sportingnews/MLB/rss.xml''
@page1 = Hpricot(open(@url1))
<%= @page 1 %>
#This does not work, and I''m scratching my head
@url1 =
2010 Sep 16
6
acts_as_solr plugin fate?
Just wanted to see if I was using the latest acts_as_solr plugin, but
the URL <http://acts_as_solr.railsfreaks.com/> takes me to a GoDaddy
domain parking page.
Anyone know what''s happened to railsfreaks, and more particularly
this plugin?
--
Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
twitter: @hassan
--
You received this
2012 Jul 07
18
Problem processing text file after uploading
I''ve got a web-app currently partially working. The user uploads a .txt,
.docx or .doc file to the server.
Currently the model handles those files, saves some metadata (the
extention and orig filename) then saves the file to the hard drive. Next
it converts the doc and docx files to plain text and saves the output to
a txt file.
My problem is I want to copy the plain text contents of
2009 Oct 23
10
Rspec Tutorial
Hi Everybody,
Greetings!!
I want to use rspec for my applications. Please guide me with the Rspec
tutorial.
I want a good example to start with.
Please help me by providing good tutorials on Rspec to start with.
I actually followed the example from http://rspec.info
Please guide me on more examples.
Waiting for your reply.
--~--~---------~--~----~------------~-------~--~----~
You received
2009 Apr 05
5
Use a value from a different model
Hello,
I cannot find the issue and it drives me crazy :(
let''s simplify. I have 2 models: saving and purchase_type
a *saving* corresponds to a *purchase_type* e.g. new sourcing or
renegotiation
a saving has exactly one purchase_type and a purchase_type has many
savings.
when I try to display the list of savings and their purchase type
(name, not Id), i get the dreaded "You have a
2012 Sep 04
5
Associations and Math between Models
I''ve setup two models, 1 and 2, that are associated by
has_and_belongs_to_many. I''m trying to get an attribute from model_1 to use
in a method in model_2. When I use the code below, I get an error saying
''undefined method model_1_id''. What am I missing? Thanks!
Model_2.rb
Class Model_2 < ActiveRecord::Base
...
has_and_belongs_to_many :model_1
def
2009 Oct 22
11
UFT8 String looks great in MySql, garbage in browser
Hi,
I have some seed data in MySql which contains non-ASCII characters (as
you''d imagine as these are worldwide placenames that I''m storing). In
MySql on the command line they look great, they''re all formatted
perfectly, including Arabic and Chinese characters and they look great.
However, when I ask my Rails model for one of these fields, and render
that in the
2010 Dec 31
9
Headers in ActiveResource
I am creating a rails app that is a gui wraping a restful web service
that uses a websso for authentication. This websso sets a series of
headers that I need to pass from the request to the
ActiveResource.find methods. As this is stuff like username etc it is
going to be different for each request. I can find examples on how to
set headers for all requests not just one.
Does anyone know of a way
2009 Jan 08
5
There is already an object named 'schema_migrations' in the database
I''ve created a table in a SQL Server database using a migration,
successfully.
I''ve tried to change the name of a column in the table and got the
error message above when running ''rake db:migrate''.
Previously I have developed using MySQL and Sqlite and migrations have
worked successfully. This is an error I have not seen before.
Has anybody seen this and worked
2009 Jun 05
15
Rails Code Indentation
Hi All,
Rails code must be readable, formatted and well indented.
I wanted to do indent code in my previous projects.
Is there any built in rails plugin/gem that can help me to
indent my existing code.
Any ideas will be really appreciated !
NOTE: Please don''t suggest editor plugins.
Thanks & Regards,
Sandip R~
--
Ruby on Rails Developer
http://sandip.sosblog.com
2010 Jan 09
9
Problem with Sessions
Hi,
Using Netbeans 6.7.1,
Rails Gem Version 2.3.2
MySQL Server 5.1
I am currently doing the depot application from the pragmatic programmer
book (agile web development with rails) everything has been fine up until
the point of creating sessions. I know they are using an earlier version of
Ruby and the gems version is 2.2.2. As soon as I put the necessary code in
the website no longer works and
2011 Aug 07
9
How can I disable Rails 3.1's ActiveRecord Query Caching?
Hey guys,
As most of you know, Rails 3.1 introduces query caching for
ActiveRecord. Great change all-in-all, but for those of us with IT
department mandates for using MySQL (yeah, yeah, I know...), it''s kind
of a mixed bag.
I need to disable query caching in a project I''m building based on
3.1. I''ve tried a couple different approaches, both without any
success. I
2010 Mar 04
25
how to share variables in data migrations (up/down)
hi there,
How do we share variables in a given data migration?
For example,
the code below fails to work because "statuses" don''t seem to be in
scope for both up and down.
class AddDefaultValuesToStatuses < ActiveRecord::Migration
statuses = [
{
''details'' => ''details'',
},
{
2011 Dec 02
20
Need Some Guides on Solr with Rails.
Hi Everyone,
I am pretty new to Rails. I have very little idea about everything. But
for my new project i have been asked to do some research on Solr search
and implement it on Rails. Please provide me some link on tutorials and
guides about Solr on Rails. Trouble is... have to do it by tomorrow.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are
2009 Jul 28
2
Rails on OS X problem
Hi All,
So far I have been unable to get rails working on a 10.5.6 OS X
installation. Every ''rails'' command ends with the following error:
/Library/Ruby/Site/1.8/rubygems.rb:827:in `report_activate_error'':
RubyGem version error: ruby-openid(2.1.7 not ~> 2.0.0)
(Gem::LoadError)
I tried uninstalling and then re-installing ruby-openid, but that
doesn''t help.
2010 Dec 01
6
Mongrel, .htaccess, cpanel, rewrite, Mongrel::HttpParserError
I just installed my RoR application on my ISP''s server.
This is a Cpanel environment and it creates a .htaccess file:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^xyz.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.xyz.com$
RewriteRule ^(.*)$ "http\:\/\/127\.0\.0\.1\:12001\/$1" [P,L]
in a public_html directory. (I changed my domain name in the text above
to xyz because we are