Skip to content
Create a gist now

Instantly share code, notes, and snippets.

class Person < ActiveRecord::Base
attr_accessor :dont_set_name
def name
def name=(attr)
@name = attr unless dont_set_name
a =
a.attributes = {name: 'George', dont_set_name: true}
#=> 'George'
a =
a.attributes = {dont_set_name: true, name: 'George'}
#=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.