[Rails] Re: STI, #update_attributes and validations.

2013-01-17 Thread Matt Jones
On Monday, 14 January 2013 13:34:29 UTC-5, Guilherme Reis wrote: i could put :if = proc { |record| record.type == 'C' } on the validations and put the validations at A class. But it wouldn't make sense to have the subclasses. The difference basically of B and C is only in the validation

[Rails] Re: STI, #update_attributes and validations.

2013-01-16 Thread Emily S
Why are you doing b = A.find(b-id) and not b = B.find(b-id) ? I think it would be better if you did b = B.find(b-id) c = b.becomes(C) try it in the console and verify that c.class is C then you should be able to do c.update_attributes(:attribute_x = 'present', :attribute_y = 'present') Your