Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
bdea0ee36a
|
@ -23,6 +23,7 @@ class Attachment < ActiveRecord::Base
|
|||
belongs_to :project, foreign_key: 'container_id', conditions: "attachments.container_type = 'Project'"
|
||||
belongs_to :softapplication, foreign_key: 'container_id', conditions: "attachments.container_type = 'Softapplication'"
|
||||
belongs_to :author, :class_name => "User", :foreign_key => "author_id"
|
||||
belongs_to :attachmentstype, :foreign_key => "attachtype"
|
||||
|
||||
validates_presence_of :filename, :author
|
||||
validates_length_of :filename, :maximum => 255
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
class Attachmentstype < ActiveRecord::Base
|
||||
attr_accessible :typeId, :typeName
|
||||
end
|
|
@ -0,0 +1,12 @@
|
|||
class CreateAttachmentstypes < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :attachmentstypes do |t|
|
||||
t.column :typeId, :integer, :null => false
|
||||
t.column :typeName, :string, :limit =>50
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :attachmentstypes
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddAttachtypeToAttachments < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :attachments, :attachtype, :int
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20140428013546) do
|
||||
ActiveRecord::Schema.define(:version => 20140508030358) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -36,6 +36,7 @@ ActiveRecord::Schema.define(:version => 20140428013546) do
|
|||
t.datetime "created_on"
|
||||
t.string "description"
|
||||
t.string "disk_directory"
|
||||
t.integer "attachtype"
|
||||
end
|
||||
|
||||
add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id"
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||
|
||||
one:
|
||||
typeId:
|
||||
typeName:
|
||||
|
||||
two:
|
||||
typeId:
|
||||
typeName:
|
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class AttachmentstypeTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
Loading…
Reference in New Issue