データベースから「test/fixtures/*.yml」にデータをダンプしましたが、使用するrake db:fixtures:load
と、yml の内容が無効であると不平を言います。以下は私のymlの内容です:
answer_00016:
id: 16
content: |-
<% output_once :define_aaa do %>
Your stuff here
<% end %>
注意してください、その<% ... %>
部分は回答の内容です。
フィクスチャをロードすると、エラー メッセージは次のようになります。
The exact error was:
NoMethodError: undefined method `output_once' for main:Object
以下は、データをダンプする私のコードです:
data = ActiveRecord::Base.connection.select_all(sql % table_name)
file.write data.inject({}) {|hash, record|
hash["#{table_name}_#{i.succ!}"] = record
hash
}.to_yaml
問題はどこだ?どうすれば修正できますか?