This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| C:\Sites\rails_project\sample_app>bundle exec rake db:reset | |
| Couldn't drop db/development.sqlite3 : #<Errno::EACCES: Permission denied - C:/Sites/rails_project/sample_app/db/development.sqlite3> | |
| db/development.sqlite3 already exists | |
| -- create_table("microposts", {:force=>true}) | |
| -> 0.0400s | |
| -- add_index("microposts", ["user_id", "created_at"], {:name=>"index_microposts_on_user_id_and_created_at"}) | |
| -> 0.0070s | |
| -- create_table("relationships", {:force=>true}) | |
| -> 0.0220s | |
| -- add_index("relationships", ["followed_id"], {:name=>"index_relationships_on_followed_id"}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class User < ActiveRecord::Base | |
| . | |
| . | |
| . | |
| . | |
| . | |
| . | |
| . | |
| . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Relationship < ActiveRecord::Base | |
| attr_accessible :followed_id | |
| belongs_to :follower, class_name: "User" | |
| belongs_to :followed, class_name: "User" | |
| validates :follower_id, presence: true | |
| validates :followed_id, presence: true | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class CreateRelationships < ActiveRecord::Migration | |
| def change | |
| create_table :relationships do |t| | |
| t.integer :follower_id | |
| t.integer :followed_id | |
| t.timestamps | |
| end | |
| add_index :relationships, :follower_id |