I *think* I have answered my own question. It looks like this may be a new feature in Rails3. The Rails documentation has been upgraded to version 3 which I hadn't noticed when I found the :restrict option. Having the documentation updated to version 3 is definitely going to be a hassle for those of us still on version 2.3.x.

Thanks, Ken


On Sep 7, 2010, at 10:01 AM, Ken Hudson wrote:

Hi All,

According to the Rails documentation, has_many associations have a :dependent option that can be set to :restrict. "If set to :restrict this object cannot be deleted if it has any associated object". This is what I wanted so I have the following code in my gallery model:

has_many :images, :dependent => :restrict

However, I am getting the following error:

"ArgumentError: The :dependent option expects either :destroy, :delete_all, or :nullify (:restrict)"

Any idea what my problem is? I'm not sure why :restrict is shown in parentheses in the error message. The documentation clearly shows it as a valid option for :dependent...

Thanks, Ken








--
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby

http://www.nealstreetdesign.com
http://www.shareastronomy.com






--
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby

Reply via email to