Add visit_id to debate

This commit is contained in:
Eloy Gomez
2015-08-08 13:09:22 +02:00
parent b23ca8deb1
commit 02f19aa4b1
3 changed files with 13 additions and 1 deletions

View File

@@ -18,6 +18,12 @@ class Debate < ActiveRecord::Base
before_validation :sanitize_description before_validation :sanitize_description
before_validation :sanitize_tag_list before_validation :sanitize_tag_list
# ahoy setup
#----------------------------------------------------------------------
visitable # Ahoy will automatically assign visit_id on create
def likes def likes
get_likes.size get_likes.size
end end

View File

@@ -0,0 +1,5 @@
class AddVisitIdToDebate < ActiveRecord::Migration
def change
add_column :debates, :visit_id, :string
end
end

View File

@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150808100936) do ActiveRecord::Schema.define(version: 20150808102442) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@@ -52,6 +52,7 @@ ActiveRecord::Schema.define(version: 20150808100936) do
t.integer "author_id" t.integer "author_id"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.string "visit_id"
end end
create_table "taggings", force: :cascade do |t| create_table "taggings", force: :cascade do |t|