SHOW:
|
|
- or go back to the newest paste.
1 | - | #models/like.rb |
1 | + | #db/schema.rb |
2 | - | class Like < ActiveRecord::Base |
2 | + | ActiveRecord::Schema.define(version: 20150709101845) do |
3 | - | belongs_to :tweet |
3 | + | |
4 | - | belongs_to :user |
4 | + | create_table "likes", force: :cascade do |t| |
5 | - | validates :user_id, presence: true |
5 | + | t.integer "user_id", limit: 4 |
6 | - | validates :tweet_id, presence: true |
6 | + | t.integer "tweet_id", limit: 4 |
7 | - | end |
7 | + | t.datetime "created_at", null: false |
8 | t.datetime "updated_at", null: false | |
9 | - | #models/tweet.rb |
9 | + | |
10 | - | class Tweet < ActiveRecord::Base |
10 | + | |
11 | - | belongs_to :user |
11 | + | add_index "likes", ["tweet_id"], name: "fk_rails_d994727f92", using: :btree |
12 | - | validates :text, presence: true, length: { maximum: 140 } |
12 | + | add_index "likes", ["user_id"], name: "fk_rails_1e09b5dabf", using: :btree |
13 | - | end |
13 | + | |
14 | create_table "tweets", force: :cascade do |t| | |
15 | - | #models/user.rb |
15 | + | t.text "text", limit: 65535 |
16 | - | class User < ActiveRecord::Base |
16 | + | t.integer "user_id", limit: 4 |
17 | - | has_many :tweets |
17 | + | t.datetime "created_at", null: false |
18 | - | has_many :likes |
18 | + | t.datetime "updated_at", null: false |
19 | - | validates :email, presence: true, uniqueness: true |
19 | + | |
20 | - | validates :password, presence: true, length: { minimum: 6, maximum: 25 } |
20 | + | |
21 | - | validates :name, presence: true, uniqueness: true, format: { with: /\A[a-zA-Z0-9]+\Z/ } |
21 | + | add_index "tweets", ["user_id"], name: "fk_rails_003928b7f5", using: :btree |
22 | - | end |
22 | + | |
23 | create_table "users", force: :cascade do |t| | |
24 | - | #views/tweets/show.html.erb |
24 | + | t.string "email", limit: 255 |
25 | - | <p id="notice"><%= notice %></p> |
25 | + | t.string "password", limit: 255 |
26 | t.string "name", limit: 255 | |
27 | - | <p> |
27 | + | t.datetime "created_at", null: false |
28 | - | <strong>Text:</strong> |
28 | + | t.datetime "updated_at", null: false |
29 | - | <%= @tweet.text %> |
29 | + | |
30 | - | </p> |
30 | + | |
31 | add_foreign_key "likes", "tweets" | |
32 | - | <p> |
32 | + | add_foreign_key "likes", "users" |
33 | - | <strong>User:</strong> |
33 | + | add_foreign_key "tweets", "users" |
34 | - | <%= @tweet.user.name %> |
34 | + |