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 => '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