Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@micmmakarov
Created August 15, 2012 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save micmmakarov/3363390 to your computer and use it in GitHub Desktop.
Save micmmakarov/3363390 to your computer and use it in GitHub Desktop.
Seed generator
def new_lined(text)
13.chr + 10.chr + text + 13.chr + 10.chr
end
posts = Post.all
posts.each do |p|
puts "Post.create(:title => '#{p.title}', :posted_on => '#{p.posted_on}' :author_id => '#{p.author_id}', :created_at => '#{p.created_at}', :updated_at => '#{p.updated_at}', :body => <<EOF"+new_lined(p.body)+"EOF)"
end
@btaitelb
Copy link

Is new_lined here specifically written for windows? Why not just use: text + "\n" and go for *nix compatibility?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment