# File 'lib/generators/templates/add_role_to_users.rb', line 11defself.downadd_column:users,:admin,:boolean,:default=>falseAtreides::User.where(:role=>:admin).each{|user|user.update_attributes!(:admin=>true)}remove_column:users,:roleend
.up ⇒ Object
2
3
4
5
6
7
8
9
# File 'lib/generators/templates/add_role_to_users.rb', line 2defself.upadd_column:users,:role,:stringAtreides::User.where(:admin=>true).eachdo|user|user.role=:adminuser.saveendremove_column:users,:adminend