Skip to content

Instantly share code, notes, and snippets.

@durran
Created July 23, 2012 12:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save durran/3163433 to your computer and use it in GitHub Desktop.
Save durran/3163433 to your computer and use it in GitHub Desktop.
Override Mongoid setter.
def cte_attr(*attrs)
attrs.each do |name|
class_eval <<-ATTR
def #{name}=(value)
@#{name} = value
super
end
ATTR
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment