Permalink
Browse files

add: type column to commentables

  • Loading branch information...
1 parent bf03b31 commit 424ddaecd68c99b003cd6fe9bb9e01a30ebf0103 @qiao committed Jul 19, 2011
View
@@ -2,3 +2,4 @@
db/*.sqlite3
log/*.log
tmp/
+*.swp
@@ -5,5 +5,7 @@ def home
def show
@page = Page.find_by_slug(params[:slug])
+ @comment = @page.comments.new
+ @path = [@page, @comment]
end
end
@@ -0,0 +1 @@
+<%= raw page.content %>
@@ -1 +1,4 @@
-<%= raw(@page.content) %>
+<%= render @page %>
+
+<%= render @page.comments %>
+<%= render 'comments/form' %>
View
@@ -12,6 +12,10 @@
resources :comments
end
+ resources :pages do
+ resources :comments
+ end
+
constraints :year => /\d{4}/, :month => /\d{2}/, :day => /\d{2}/ do
get ':year/:month/:day/:slug' => 'posts#show'
end
@@ -0,0 +1,9 @@
+class AddTypeToCommentables < ActiveRecord::Migration
+ def self.up
+ add_column :commentables, :type, :string
+ end
+
+ def self.down
+ remove_column :commentables, :type
+ end
+end
View
@@ -10,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20110717111100) do
+ActiveRecord::Schema.define(:version => 20110719011136) do
create_table "commentables", :force => true do |t|
t.string "title"
@@ -19,6 +19,7 @@
t.string "slug"
t.datetime "created_at"
t.datetime "updated_at"
+ t.string "type"
end
create_table "comments", :force => true do |t|

0 comments on commit 424ddae

Please sign in to comment.