如何与工厂打交道attr_accessible
?
我的例子:
# model
class SomeModel
attr_accessible :name, full_name, other_name
end
#spec
require 'spec_helper'
describe "test" do
it do
create(:some_model, name: "test name", user: User.first) #factory
end
end
#error
ruby(17122,0x12a055000) malloc: *** error for object 0x8: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
我认为错误是因为user_id
不在attr_accessible
属性中。