Ryan Bates railscasts に見られるように Globalize 3 gem を使用していますが、すべて正常に動作します。ただし、データをシードする方法を知る必要があります。現在、次のスキーマでmonthly_post_translationsというテーブルを作成しました
schema.rb
create_table "monthly_post_translations", :force => true do |t|
t.integer "monthly_post_id"
t.string "locale"
t.text "body"
t.datetime "created_at"
t.datetime "updated_at"
end
このテーブルにシード データを追加する必要がありますが、操作するモデルがありません。どうすればよいですか?
これが機能していない私の電流の種です。
種.rb
# Monthly Posts
MonthlyPost.delete_all
monthlypost = MonthlyPost.create(:body => "Monthly Post Text")
#Monthly Posts Spanish Translation
monthlytranslation = MonthlyPostTranslation.create(:body => "Spanish Translation of monthly post text",
:monthly_post_id => monthlypost.id,
:locale => "es" )
しかし、monthly_post_translation テーブルには操作できるモデルがないため、エラーが発生します。
uninitialized constant MonthlyPostTranslation
このシードデータを適切に追加する方法について何か考えはありますか?