Created
May 9, 2012 15:14
-
-
Save denniskuczynski/2645360 to your computer and use it in GitHub Desktop.
Example of updating a Rails Model attribute in place
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it "tries to update a Model's string attribute in place" do | |
person = Person.new | |
person.name = "" | |
person.save! | |
person.reload | |
person.name = "" | |
person.name << "TEST" | |
person.save! | |
person.reload | |
person.name.should eq("") | |
person.name = "" | |
person.name_will_change! | |
person.name << "TEST" | |
person.save! | |
person.reload | |
person.name.should eq("TEST") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment