Browse files

compatible with recent changes to sequel ... table_exists? will retur…

…n true as soon as set_schema has been called (regardless of whether or not create_table has been called)
  • Loading branch information...
1 parent b8fe1e6 commit 57b8b5cb53b76cdd7664eeb31875986711447218 S. Brent Faulkner committed Dec 10, 2008
Showing with 10 additions and 9 deletions.
  1. +10 −9 lib/post.rb
View
19 lib/post.rb
@@ -4,13 +4,16 @@
require 'syntax/convertors/html'
class Post < Sequel::Model
- set_schema do
- primary_key :id
- text :title
- text :body
- text :slug
- text :tags
- timestamp :created_at
+ unless Post.table_exists?
+ set_schema do
+ primary_key :id
+ text :title
+ text :body
+ text :slug
+ text :tags
+ timestamp :created_at
+ end
+ create_table
end
def url
@@ -75,5 +78,3 @@ def split_content(string)
[ to_html(show.join("\n\n")), hide.size > 0 ]
end
end
-
-Post.create_table unless Post.table_exists?

0 comments on commit 57b8b5c

Please sign in to comment.