Created
September 6, 2011 15:07
-
-
Save Zequez/1197799 to your computer and use it in GitHub Desktop.
attr_readonly error
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
# Model: | |
class User < ActiveRecord::Base | |
attr_readonly :email | |
end | |
# Controller: | |
user = User.new :email => 'foo@bar.com' | |
puts user.email | |
#=> foo@bar.com | |
user.save | |
user.update_attributes :email => 'bar@foo.com' | |
puts user.email | |
#=> bar@foo.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment