Skip to content

Instantly share code, notes, and snippets.

View iblue's full-sized avatar
🕶️
"><script>alert(1);</script>{{1+1}}

iblue

🕶️
"><script>alert(1);</script>{{1+1}}
  • Mannheim, Germany
View GitHub Profile
@iblue
iblue / embed.rb
Created July 8, 2012 18:13 — forked from netzpirat/embed.rb
ActiveRecord embedding
module ActiveRecord
# Allows embedding of ActiveRecord models.
#
# Embedding other ActiveRecord models is a composition of the two
# and leads to the following behaviour:
#
# - Nested attributes are accepted on the parent without the _attributes suffix
# - Mass assignment security allows the embedded attributes
# - Embedded models are destroyed with the parent when not appearing in an update again
# - Embedded documents appears in the JSON output