Generate reposts model/table that stores the repost history.
This commit is contained in:
parent
07f8b4c7d8
commit
37cff9c4ba
4 changed files with 32 additions and 0 deletions
2
app/models/repost.rb
Normal file
2
app/models/repost.rb
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
class Repost < ActiveRecord::Base
|
||||
end
|
||||
12
db/migrate/20131208115327_create_reposts.rb
Normal file
12
db/migrate/20131208115327_create_reposts.rb
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
class CreateReposts < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :reposts do |t|
|
||||
t.string :mentioned
|
||||
t.bigint :postid
|
||||
t.bigint :repostid
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
add_index :reposts, :repostid
|
||||
end
|
||||
end
|
||||
11
test/fixtures/reposts.yml
vendored
Normal file
11
test/fixtures/reposts.yml
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
mentioned: MyString
|
||||
postid:
|
||||
repostid:
|
||||
|
||||
two:
|
||||
mentioned: MyString
|
||||
postid:
|
||||
repostid:
|
||||
7
test/models/repost_test.rb
Normal file
7
test/models/repost_test.rb
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class RepostTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue