Forked from anonymous/feature_and_milestone.rb
Last active
December 29, 2015 22:39
-
-
Save universal/7738070 to your computer and use it in GitHub Desktop.
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 Feature < ActiveRecord::Base | |
| has_one :project_item, as: :item, class_name: "ProjectItem" | |
| end | |
| class Milestone < ActiveRecord::Base | |
| has_one :project_item, as: :item, class_name: "ProjectItem" | |
| end |
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 Project < ActiveRecord::Base | |
| has_many :project_items | |
| has_many :features, through: :project_items, source_type: "Feature", source: :item | |
| has_many :milestones, through: :project_items, source_type: "Milestone", source: :item | |
| end |
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 ProjectItem < ActiveRecord::Base | |
| belongs_to :item, touch: true, polymorphic: true | |
| belongs_to :project, touch: true | |
| end |
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
| create_table "project_items", force: true do |t| | |
| t.integer "project_id" | |
| t.integer "item_id" | |
| t.string "item_type" | |
| t.integer "position" | |
| t.datetime "created_at" | |
| t.datetime "updated_at" | |
| end | |
| create_table "projects", force: true do |t| | |
| t.string "name" | |
| t.datetime "created_at" | |
| t.datetime "updated_at" | |
| end | |
| create_table "features", force: true do |t| | |
| t.string "name" | |
| t.datetime "created_at" | |
| t.datetime "updated_at" | |
| end | |
| create_table "milestones", force: true do |t| | |
| t.string "name" | |
| t.datetime "created_at" | |
| t.datetime "updated_at" | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment