2011-09-11 36 views

回答

6

這是attr_readonly做:

class User < ActiveRecord::Base 
    attr_readonly :username 
end 

u = User.create(:username => 'dude') 
u.username # => 'dude' 

u.update_attributes(:username => 'dudette') 
u.reload.username # => 'dude' 
相關問題