This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# rake task to dump these tables | |
# post | |
file = "/tmp/post_data.csv" | |
posts = Post.all.order(:id => :desc) | |
columns = Post.columns.map { |column| column.name } | |
CSV.open( file, 'w' ) do |writer| | |
posts.each do |s| | |
writer << s.attributes.map { |a,v| v } | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# copy all the blocks in a story to another story | |
def copy_story_blocks(params, replace_all_blocks = false) | |
HashParamsChecker.check_params!({ :user_id => 22, | |
:story_id => 44, | |
:revision_id => 55, | |
:block_id => 66, | |
:from_story_id => 2, | |
:to_story_id => 1 }, | |
params | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Task update all posts that have more than one content_item in a row. | |
# Create a content_gallery and put them in it. Remove the original content_items | |
# Save the post with a new revision | |
# Example: one post | |
post = Post.find(22628) | |
story = Story.find_by_id(post.story_id) | |
story_block_ids = StoryRevisionsBlock.where(:story_revision_id => story.draft_revision_id).pluck(:story_block_id) | |
content_items = nil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'curb' | |
require 'json' | |
urls = [ | |
"/blog/21665-recipes-to-use-miso/an", | |
"/blog/20423-joshua-fields-millburn-the-minimalists-rebecca-shern-minimal-wellness-interview/an", | |
"/blog/21574-the-tunisian-lamb-stew-i-first-tasted-in-the-desert-recreated-at-home/an", | |
"/blog/21574-the-tunisian-lamb-stew-i-first-tasted-in-the-desert-recreated-at-home/an", | |
"/blog/21632-instant-stock-broth-hack-for-quick-braised-fish/an", | |
"/blog/21224-an-interview-with-buffy-maguire-of-lady-falcon-coffee-club-about-blends/an", |
NewerOlder