Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- `class CreateSectionEdits < ActiveRecord::Migration[5.2]`
- `def up`
- `create_table :section_edits do |t|`
- t.integer "admin_user_id"
- t.integer "section_id"
- t.string "summary"
- t.timestamps
- end
- add_index("section_edits", ["admin_user_id", "section_id"])
- end
- def down
- drop_table :section_edits
- end
- end
- `
- class SectionEdit < ApplicationRecord
- belongs_to :admin_users, optional: true
- belongs_to :section
- end
- class AdminUser < ApplicationRecord
- #self.table_name = "admin_users"
- has_and_belongs_to_many :pages
- has_many :section_edits
- end
- class Section < ApplicationRecord
- belongs_to :page, { :optional => false}
- has_many :section_edits
- end
Add Comment
Please, Sign In to add comment