Guest User

Untitled

a guest
Jun 25th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. class Dinner
  2. include Mongoid::Document
  3. include Mongoid::Timestamps
  4.  
  5. field :title, :type => String
  6. field :description, :type => String
  7. field :hosted_by, type => String
  8. field :contact_phone, type => String
  9. field :address, type => String
  10.  
  11. references_one :country
  12.  
  13. validates_presence_of :title
  14. end
  15.  
  16.  
  17. class Country
  18. include Mongoid::Document
  19. field :name, :type => String
  20. referenced_in :dinner
  21.  
  22. validates_presence_of :name
  23. end
  24.  
  25. = form_for @dinner do |f|
  26. ...
  27. .field
  28. = f.label :country
  29. = f.select :country, Country.find(:all).collect{ |c| [c.name,c.id]}
Add Comment
Please, Sign In to add comment