I know, I know, I could do it with SQL but I have noted a remarkable ability at the day job to forget to include the where clause after a week of crunch. That can have remarkably negative consequences, particularly since the Rails DB doesn't have any particular constraints on it. (It has ActiveRecord validations and, beyond that, you typically have to type more stuff, rather than less stuff, to cause massive screwups.)
c = Customer.find_by_username "[email protected]"
c.username = "[email protected]"
c.save!
I know, I know, I could do it with SQL but I have noted a remarkable ability at the day job to forget to include the where clause after a week of crunch. That can have remarkably negative consequences, particularly since the Rails DB doesn't have any particular constraints on it. (It has ActiveRecord validations and, beyond that, you typically have to type more stuff, rather than less stuff, to cause massive screwups.)