-
-
Save anonymous/f9b197b0a0c2e1d54a1a to your computer and use it in GitHub Desktop.
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
class User < ActiveRecord::Base | |
string :name | |
def foo | |
name = "Bar" | |
end | |
def working_foo | |
self.name = "Bar" | |
end | |
end | |
user = User.new | |
user.name = "FooBar" | |
puts user.name # => FooBar | |
# This makes no change | |
user.foo | |
puts user.name # => FooBar | |
# This makes the change in the current instance of user | |
user.working_foo | |
puts user.name # => Bar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment