Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Dinner
- include Mongoid::Document
- include Mongoid::Timestamps
- field :title, :type => String
- field :description, :type => String
- field :hosted_by, type => String
- field :contact_phone, type => String
- field :address, type => String
- references_one :country
- validates_presence_of :title
- end
- class Country
- include Mongoid::Document
- field :name, :type => String
- referenced_in :dinner
- validates_presence_of :name
- end
- = form_for @dinner do |f|
- ...
- .field
- = f.label :country
- = f.select :country, Country.find(:all).collect{ |c| [c.name,c.id]}
Add Comment
Please, Sign In to add comment