I'm using Ruby and especially Ruby on Rails only for a short time, so
please excuse me, if the answer to my following question is obvious.
Please also excuse my bad English, it's not my mother tongue - feel
free to give me hints how to improve my English
I have a two model files called StorageSlot and Product:
class StorageSlot < ActiveRecord::Base
class Building < ActiveRecord::Base
Now I can access all products belonging to a slot by using
slot.products. I even can add products using slot.products <<,
slot.products.build, slot.products.create, and so on. Each slot has a
specified number of maximal products, which is of course not
recognized by these methods. How can I overwrite them to perform a
check if the slot is already full ?
I hope you understand my problem as I don't have any ideas how to
solve it. Thank you for your help in advance and greetings from