如何測試模型接受圖像的嵌套屬性的主題? Given /^I have topics titled (.+)$/ do |titles|
path ="#{RAILS_ROOT}/features/upload-files/"
image = File.new(path + "image.jpg")
titles.split(', ').each do |title|
使用accepts_nested_attributes_for +質量分配保護假設你有這樣的結構: class House < ActiveRecord::Base
has_many :rooms
accepts_nested_attributes_for :rooms
attr_accessible :rooms_attributes
end
class Ro