[refs #18] changed refs id to string
This commit is contained in:
parent
dda40d9e9d
commit
c18b71bf0b
|
@ -4,7 +4,11 @@ class Issue < ActiveRecord::Base
|
||||||
belongs_to :project
|
belongs_to :project
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
has_many :comments, :as => :commentable
|
has_many :comments, :as => :commentable,
|
||||||
|
:finder_sql => 'SELECT comments.* FROM comments ' +
|
||||||
|
'WHERE comments.commentable_id = \'#{self.id}\' ' +
|
||||||
|
' AND comments.commentable_type = \'#{self.class.name}\' ' +
|
||||||
|
'ORDER BY comments.created_at'
|
||||||
has_many :subscribes, :as => :subscribeable
|
has_many :subscribes, :as => :subscribeable
|
||||||
|
|
||||||
validates :title, :body, :project_id, :presence => true
|
validates :title, :body, :project_id, :presence => true
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
class ChangeCommentableId < ActiveRecord::Migration
|
||||||
|
def self.up
|
||||||
|
change_column :comments, :commentable_id, :string
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.down
|
||||||
|
change_column :comments, :commentable_id, :integer
|
||||||
|
end
|
||||||
|
end
|
19
db/schema.rb
19
db/schema.rb
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20111228182425) do
|
ActiveRecord::Schema.define(:version => 20120111080234) do
|
||||||
|
|
||||||
create_table "arches", :force => true do |t|
|
create_table "arches", :force => true do |t|
|
||||||
t.string "name", :null => false
|
t.string "name", :null => false
|
||||||
|
@ -87,7 +87,7 @@ ActiveRecord::Schema.define(:version => 20111228182425) do
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "comments", :force => true do |t|
|
create_table "comments", :force => true do |t|
|
||||||
t.integer "commentable_id"
|
t.string "commentable_id"
|
||||||
t.string "commentable_type"
|
t.string "commentable_type"
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
t.text "body"
|
t.text "body"
|
||||||
|
@ -165,6 +165,13 @@ ActiveRecord::Schema.define(:version => 20111228182425) do
|
||||||
|
|
||||||
add_index "issues", ["project_id", "serial_id"], :name => "index_issues_on_project_id_and_serial_id", :unique => true
|
add_index "issues", ["project_id", "serial_id"], :name => "index_issues_on_project_id_and_serial_id", :unique => true
|
||||||
|
|
||||||
|
create_table "permissions", :force => true do |t|
|
||||||
|
t.integer "right_id"
|
||||||
|
t.integer "role_id"
|
||||||
|
t.datetime "created_at"
|
||||||
|
t.datetime "updated_at"
|
||||||
|
end
|
||||||
|
|
||||||
create_table "platforms", :force => true do |t|
|
create_table "platforms", :force => true do |t|
|
||||||
t.string "description"
|
t.string "description"
|
||||||
t.string "name"
|
t.string "name"
|
||||||
|
@ -262,6 +269,14 @@ ActiveRecord::Schema.define(:version => 20111228182425) do
|
||||||
t.string "owner_type"
|
t.string "owner_type"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "rights", :force => true do |t|
|
||||||
|
t.string "name", :null => false
|
||||||
|
t.string "controller", :null => false
|
||||||
|
t.string "action", :null => false
|
||||||
|
t.datetime "created_at"
|
||||||
|
t.datetime "updated_at"
|
||||||
|
end
|
||||||
|
|
||||||
create_table "rpms", :force => true do |t|
|
create_table "rpms", :force => true do |t|
|
||||||
t.string "name", :null => false
|
t.string "name", :null => false
|
||||||
t.integer "arch_id", :null => false
|
t.integer "arch_id", :null => false
|
||||||
|
|
Loading…
Reference in New Issue