Skip to content

Instantly share code, notes, and snippets.

@marklocklear
Created November 29, 2011 16:03
Show Gist options
  • Select an option

  • Save marklocklear/1405319 to your computer and use it in GitHub Desktop.

Select an option

Save marklocklear/1405319 to your computer and use it in GitHub Desktop.
Copy object attributes
ruby-1.9.2-head :001 > t = Template.first
=> #<Template id: 1, name: "Computer Tech Template", created_at: "2011-11-22 18:38:45", updated_at: "2011-11-22 18:38:45">
r = Rubric.new(t.attributes.merge(:name => t.name, :created_at => t.created_at))
=> #<Rubric id: nil, name: "Computer Tech Template", section_id: nil, created_at: "2011-11-22 18:38:45", updated_at: "2011-11-22 18:38:45", competency: nil>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment