Sha256: 8a5756d6bdf1b701d555494ce833bc3e2e340f0149f28bc84d68ccf63dcbdcff
Contents?: true
Size: 620 Bytes
Versions: 2
Compression:
Stored size: 620 Bytes
Contents
class CreatePosts < ActiveRecord::Migration def self.up create_table :posts do |t| t.column :user_id, :int t.column :slug, :string, :limit => 150 t.column :title, :string t.column :content, :text t.column :published, :boolean, :default => false t.column :views, :int, :default => '0' t.timestamps end post = Post.new({ :user_id=>0, :title=>"Welcome post", :content=>"First post content ... <hr />", :published=>true }) post.tag_list = "first, santey_blog" post.save end def self.down drop_table :posts end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
santey_blog-0.2.1 | lib/generators/templates/migrations/create_posts.rb |
santey_blog-0.2.0 | lib/generators/templates/migrations/create_posts.rb |