Last Updated: February 25, 2016
·
6.115K
· raysrashmi

Use toggle to update a boolean type attribute

User model has activated boolean attribute

just do @user.toggle :activated to change 'activated' value

@user.activated => true
@user.toggle :activated
@user.save

@user.activated => false