Skip to content

Instantly share code, notes, and snippets.

@jasononaquest
Last active August 29, 2015 14:18
Show Gist options
  • Save jasononaquest/af3b42eae9d1156346de to your computer and use it in GitHub Desktop.
Save jasononaquest/af3b42eae9d1156346de to your computer and use it in GitHub Desktop.
copy_list.rb
class CopyList
attr_reader :list, :new_name
def initialize(list, new_name)
@list = list
@new_name = new_name
end
def call
new_list = List.new(list.dup.attributes.merge(name: new_name))
new_list.save
new_list
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment