Skip to content

Instantly share code, notes, and snippets.

@genki
Created February 18, 2009 11:26
Show Gist options
  • Save genki/66299 to your computer and use it in GitHub Desktop.
Save genki/66299 to your computer and use it in GitHub Desktop.
module Merb
module Fixtures
class Hash
def code_to_create_record(model, hash)
resource = model.new(hash)
resource.send :hookable__create_nan_before_advised
resource
end
def code_to_create_child_record(parent_record, relation_name, hash)
resource = parent_record.send(relation_name).new(hash)
resource.send :hookable__create_nan_before_advised
resource
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment