Skip to content

Instantly share code, notes, and snippets.

@alindeman
Created January 13, 2011 02:46
Show Gist options
  • Select an option

  • Save alindeman/777312 to your computer and use it in GitHub Desktop.

Select an option

Save alindeman/777312 to your computer and use it in GitHub Desktop.
class Model < ActiveRecord::Base
# Just as an example, encode as JSON/XML
# excluding the created_at attribute
def serializable_hash(options = nil)
options ||= {}
(options[:except] ||= []) << :created_at
super(options)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment