Guest User

Untitled

a guest
Apr 24th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. class Assignment < ActiveRecord::Base
  2.  
  3. belongs_to :user
  4. belongs_to :issue
  5.  
  6.  
  7. end
  8.  
  9. class User < ActiveRecord::Base
  10. has_many :issues # Poor user!
  11.  
  12. has_many :assignments
  13. has_many :tasks, :through => :assignments, :source => :issue
  14.  
  15. def fullname
  16. firstname + " " + lastname
  17. end
  18.  
  19. end
  20.  
  21. class Issue < ActiveRecord::Base
  22.  
  23. belongs_to :issue_category
  24. belongs_to :user
  25.  
  26. has_many :assignments
  27. has_many :owners, :through => :assignments, :source => :user
  28.  
  29. end
  30.  
  31.  
  32.  
  33.  
  34. create_table "assignments", :force => true do |t|
  35. t.integer "issue_id"
  36. t.integer "user_id"
  37. t.datetime "due_date"
  38. end
  39.  
  40. create_table "issues", :force => true do |t|
  41. t.datetime "created_at"
  42. t.datetime "updated_at"
  43. t.string "subject"
  44. t.integer "user_id"
  45. t.string "type"
  46. t.integer "status", :default => 0
  47. t.text "body"
  48. end
  49.  
  50. create_table "users", :force => true do |t|
  51. t.datetime "created_at"
  52. t.datetime "updated_at"
  53. t.string "firstname"
  54. t.string "lastname"
  55. t.string "email"
  56. end
Add Comment
Please, Sign In to add comment