Saturday, May 26, 2012

Re: [Rails] no method "each" method for nilclass

On 27 May 2012 06:31, Prajwal B. <lists@ruby-forum.com> wrote:
> Dir.glob("data-hold/pages/*.html").each do |fname|
>   meta_info = File.basename(fname, '.html').split('--')
>   page = Nokogiri::HTML(open(fname))
>
> page.css("#{TABLE_DIV_ID} tr")[1..-2].each do |tr|
>      data_tds = tr.css(td).map{ |td|
>         td.text.gsub(/[$,](?=\d)/, '').gsub(/\302\240|\s/, '').strip
>      }
>
> error in each do method in first line of both blocks

Why have you posted this again rather than continuing with previous
thread? As I said previously the object you are calling .each on must
be nil. Have a look at the Rails Guide on Debugging for suggestions
as to how to debug the code to find out why.

Colin

>
> block irb binding  in second block first line
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate