hi, I''m wondering where can I check if an attribute is going to change? my_var = @session[:my_var] my_var.attributes = @params[''my_var''] my_var.save here I know @session[:my_var].the_attribute is different from @params[''my_var''].the_attribute but I would check it within the model! I''ve tried in before_validation_on_update but self.the_attribute and the_attribute_before_type_cast have the same value (actually before tc it''s still a string but has the same value) Someone has a suggestion? Thanks, Enrico -- "The only thing necessary for the triumph of evil is for good men to do nothing" Edmund Burke
Has anyone on the list addressed anything like this? I''m dealing with a legacy database as the authoritative source for information in my Rails app. Instead of loading all info for all records and manually comparing (or just overwriting), I''d like to automatically compare a newly created object to a stored object. Is this possible in Rails yet? I saw this ticket, but I''m unsure of how it would patch into 0.13.1: http://dev.rubyonrails.com/ticket/1423 Thanks, Sean On Jul 18, 2005, at 5:04 AM, Enrico Teotti wrote:> hi, > I''m wondering where can I check if an attribute is going to change? > my_var = @session[:my_var] > my_var.attributes = @params[''my_var''] > my_var.save > > here I know @session[:my_var].the_attribute is different from > @params[''my_var''].the_attribute but I would check it within the model! > > I''ve tried in before_validation_on_update but self.the_attribute and > the_attribute_before_type_cast have the same value (actually before tc > it''s still a string but has the same value) > > Someone has a suggestion? > Thanks, > Enrico > > -- > "The only thing necessary for the triumph of evil > is for good men to do nothing" > Edmund Burke > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >------- Sean Hussey Web Database Specialist Berklee College of Music 617-747-2926
Has anyone on the list addressed anything like this? I''m dealing with a legacy database as the authoritative source for information in my Rails app. Instead of loading all info for all records and manually comparing (or just overwriting), I''d like to automatically compare a newly created object to a stored object. Is this possible in Rails yet? I saw this ticket, but I''m unsure of how it would patch into 0.13.1: http://dev.rubyonrails.com/ticket/1423 Thanks, Sean On Jul 18, 2005, at 5:04 AM, Enrico Teotti wrote:> hi, > I''m wondering where can I check if an attribute is going to change? > my_var = @session[:my_var] > my_var.attributes = @params[''my_var''] > my_var.save > > here I know @session[:my_var].the_attribute is different from > @params[''my_var''].the_attribute but I would check it within the model! > > I''ve tried in before_validation_on_update but self.the_attribute and > the_attribute_before_type_cast have the same value (actually before tc > it''s still a string but has the same value) > > Someone has a suggestion? > Thanks, > Enrico > > -- > "The only thing necessary for the triumph of evil > is for good men to do nothing" > Edmund Burke > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > >------- Sean Hussey Web Database Specialist Berklee College of Music 617-747-2926