I’m doing something wrong and it’s either in the method i’m trying to alter data with or the way i have an association defined.
class Hive
has_many :bees, :dependent => :destroy
end
class Bee
belongs_to :hive
attr_accessor :alive, :name
end
>h = Hive.create()
>h.bees.where(:alive => false).count = 100 #created from after_initialize
>h.bees.where(:alive => false).each {|b|b.name="Walter"}
>h.bees.where(:name => "Walter").count = 0
What am I doing wrong?
Thanks!
This should do the trick…
If there is no validation for