Skip to content

Instantly share code, notes, and snippets.

@fcastellanos
Created October 4, 2010 20:19
Show Gist options
  • Save fcastellanos/610351 to your computer and use it in GitHub Desktop.
Save fcastellanos/610351 to your computer and use it in GitHub Desktop.
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]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment