Skip to content

Instantly share code, notes, and snippets.

@Zequez
Created September 6, 2011 15:07
Show Gist options
  • Save Zequez/1197799 to your computer and use it in GitHub Desktop.
Save Zequez/1197799 to your computer and use it in GitHub Desktop.
attr_readonly error
# Model:
class User < ActiveRecord::Base
attr_readonly :email
end
# Controller:
user = User.new :email => '[email protected]'
puts user.email
#=> [email protected]
user.save
user.update_attributes :email => '[email protected]'
puts user.email
#=> [email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment