Skip to content

Commit

Permalink
compatible with recent changes to sequel ... table_exists? will retur…
Browse files Browse the repository at this point in the history
…n true as soon as set_schema has been called (regardless of whether or not create_table has been called)
  • Loading branch information
S. Brent Faulkner committed Dec 10, 2008
1 parent b8fe1e6 commit 57b8b5c
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions lib/post.rb
Expand Up @@ -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
Expand Down Expand Up @@ -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.