有模型
Class ModelA < ActiveRecord::Base
has_many :apples
before_save :include_prime_apple_in_apples
has_one :prime_apple
def include_prime_apple_in_apples
self.apple_ids << prime_apple_1.id
end
end
l=ModelA.new(:apple_ids => [ "ap_1_id", "ap_2_id"],:prime_apple => prime_apple_1)
l.save
l.apple_ids.should include(prime_apple_1.id) # this doesnt seem to work
如何更改为关联传递的参数?