Hey guys, I was wondering if someone could give me some insight on an
issue I'm having.

I am working on a Rails app that will be a data efficient, user
friendly New King James Version of the Bible.

What I am presently doing is making a Rake task to build all the
chapters to all of the books.

So I created an array of Regex's, to insert the expression to look
for, but when I loop through the array, I'm getting an error, and not
sure why.

This is what I have:

desc "Build All Chapters"
task :build_all_chapters => :environment do
  require 'mechanize'
  agent = Mechanize.new
  agent.get("http://www.biblegateway.com/versions/New-King-James-
Version-NKJV-Bible/#booklist")
  books = Book.all.count
  i = 0
  book_names = Array[/Genesis/, /Exodus/, /Leviticus/, /Numbers/, /
Deuteronomy/, /Joshua/, /Judges/, /Ruth/,
           /1\+Samuel/, /2\+Samuel/, /1\+Kings/, /2\+Kings/, /1\
+Chronicles/, /2\+Chronicles/,
                       /Ezra/, /Nehemiah/, /Esther/, /Job/, /Psalm/, /
Proverbs/, /Ecclesiastes/, /Song\+of\+Solomon/,
           /Isaiah/, /Jeremiah/, /Lamentations/, /Ezekiel/, /
Daniel/, /
Hosea/, /Joel/, /Amos/, /Obadiah/,
           /Jonah/, /Micah/, /Nahum/, /Habakkuk/, /Zephaniah/, /
Haggai/, /Zechariah/, /Malachi/, /Matthew/,
           /Mark/, /Luke/, /John/, /Acts/, /Romans/, /1\
+Corinthians/, /2\+Corinthians/, /Galatians/,
                       /Ephesians/, /Philippians/, /Colossians/, /1\
+Thessalonians/, /2\+Thessalonians/, /1\+Timothy/,
                       /2\+Timothy/, /Titus/, /Philemon/, /Hebrews/, /
search\=James/, /1\+Peter/, /2\+Peter/, /1\+John/,
           /2\+John/, /3\+John/, /Jude/, /Revelation/]
  books.times do
    book_names.each do |book_title|
      chapters = agent.page.links_with(book_title).count
      Chapter.create!(:name => "Chapter #{i += 1}", :book_id => i +=
1)
    end
  end
end

I get the error:

undefined method `all?' for /Genesis/:Regexp

I'm not sure what this error means, and I haven't had much luck on
Google...

Thanks in advance for your help.

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to