Skip to content

Instantly share code, notes, and snippets.

View xdite's full-sized avatar

Yi-Ting Cheng xdite

View GitHub Profile
~ SELECT `db_tags`.`id`, `db_tags`.`name` FROM `db_tags` INNER JOIN `db_site_tags` ON (`db_tags`.`id` = `db_site_tags`.`tagid`) WHERE (`db_site_tags`.`db_site_id` = 1) GROUP BY `db_tags`.`id`, `db_tags`.`name` ORDER BY `db_tags`.`id`
~ SELECT `id`, `name`, `url`, `createtime` FROM `db_sites` WHERE (`id` = 1) ORDER BY `id` LIMIT 1
~ SELECT `db_tags`.`id`, `db_tags`.`name` FROM `db_tags` INNER JOIN `db_site_tags` ON (`db_tags`.`id` = `db_site_tags`.`tagid`) WHERE (`db_site_tags`.`db_site_id` = 1) GROUP BY `db_tags`.`id`, `db_tags`.`name` ORDER BY `db_tags`.`id`
namespace :dev do
desc "Rebuild system"
task :build => ["db:automigrate","db:create", "db:migrate", :fake ]
desc "create fake blog"
task :fake do
puts "fake blog"
DbSite.create!(:name => "DK's Blog", :url => "http://blog.gslin.org", :createtime => Time.now.to_i )
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
<channel>
<title>出版新聞看板</title>
<link>http://www.wawabook.com.tw/comic/0101.php</link>
<description></description>
<item>
<title>GOSICKs(02)遠離夏季的列車 (櫻庭一樹)</title>
<link></link>
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rss version=\"2.0\"\n xmlns:trackback=\"http://madskills.com/public/xml/rss/module/trackback/\">\n <channel>\n <title></title>\n <link></link>\n <description></description>\n </channel>\n</rss>"
def index
@posts = Post.find(:all)
end
def show
@post = Post.find(params[:id])
end
def edit
@post = Post.find(params[:id])
end
def new
@post = Post.new
end
def create
@post = Post.new(params[:post])
if @post.save
flash[:notice] = 'Post was successfully created.'
redirect_to blog_path(@post)
else
render :action => "new"
end
end
def create
@post = Post.new(params[:post])
if @post.save
flash[:notice] = 'Post was successfully created.'
redirect_to blog_path(@post)
else
render :action => "new"
end
end