Skip to content

Instantly share code, notes, and snippets.

@UserAd
Created September 17, 2010 16:14
Show Gist options
  • Save UserAd/584456 to your computer and use it in GitHub Desktop.
Save UserAd/584456 to your computer and use it in GitHub Desktop.
class Item < ActiveRecord::Base
serialize :attrs
def method_missing(name, *args)
super
rescue NoMethodError
self.attrs = {} if self.attrs.nil?
if args.empty?
self.attrs[name.to_s]
else
self.attrs[name.to_s.sub("=","")] = args.first
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment