Skip to content

Instantly share code, notes, and snippets.

@eviltrout
eviltrout / gist:2493434
Created April 25, 2012 21:10
Simple template
{{#each suggestedUsers}}
<li>
{{selectedUser}}
<a href='#' {{action completeUser}} {{bindAttr data-username="this"}}>{{this}}</a>
</li>
{{/each}}
Account.transaction do
david.withdrawal(100)
mary.deposit(100)
end
def make_new(obj, hash)
new_ob = type.new
# Two approaches - 1st: You can use the array notation [] on an activerecord to use it like a hash
hash.each do {|key, value| new_ob[key] = value }
# Or you can send to the method using period:
hash.each do {|key, value| new_ob.send("#{key.to_s}=", value) }
end