Я работал над приложением Rails 4.0 с sqlite (по умолчанию для среды разработки Rails) для событий (hackathons), у которых есть родительская модель Event, для которой может быть много Press_Blurbs.
Сначала я запустил несколько генераторов лесов, которые создали некоторые миграции, которые я запускал, казалось бы, без проблем:
class CreateEvents < ActiveRecord::Migration
def change
create_table :events do |t|
t.string :city
t.string :theme
t.datetime :hackathon_start
t.datetime :hackathon_end
t.datetime :show_start
t.datetime :show_end
t.text :about
t.string :hack_rsvp_url
t.string :show_rsvp_url
t.timestamps
end
end
end
class CreatePressBlurbs < ActiveRecord::Migration
def change
create_table :press_blurbs do |t|
t.string :headline
t.string :source_name
t.string :source_url
t.string :logo_uri
t.timestamps
end
end
end
Затем я добавил некоторые отношения к моделям:
class Event < ActiveRecord::Base
has_many :press_blurbs
end
class PressBlurb < ActiveRecord::Base
belongs_to :event
end
... и добавил/выполнил миграцию, чтобы добавить ссылку на таблицу:
class AddEventRefToPressBlurbs < ActiveRecord::Migration
def change
add_column :press_blurbs, :event, :reference
end
end
Тем не менее, когда я смотрю на schema.db, это то, что я вижу вместо определения таблиц:
# Could not dump table "events" because of following NoMethodError
# undefined method `[]' for nil:NilClass
# Could not dump table "press_blurbs" because of following NoMethodError
# undefined method `[]' for nil:NilClass
Другие несвязанные таблицы отображаются в schema.rb отлично, но это не так. Любая идея, что происходит?