I'm doing something slightly unorthodox here, in that I'm just populating the database via a migration, and using the contents of a textfile. I'm using the following method which doesn't import the entire file, can anyone suggest a solution to this?:
class AddChapters < ActiveRecord::Migration
def self.up
Chapter.create!(:title => "chapter 1",
:body => File.open("#{Rails.root}/chapters/chapter1.txt").gets)
Chapter.create!(:title => "Chapter 2",
:body => File.open("#{Rails.root}/chapters/chapter2.txt").gets)
Chapter.create!(:title => "Chapter 3",
:body => File.open("#{Rails.root}/chapters/chapter3.txt").gets)
end
def self.down Chapter.all.each do |chapter| chapter.delete end end end