Skip to content

Instantly share code, notes, and snippets.

@pencilcheck
Created December 28, 2010 23:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pencilcheck/757886 to your computer and use it in GitHub Desktop.
Save pencilcheck/757886 to your computer and use it in GitHub Desktop.
# _form.html.erb
<%= form_for @profile do |f| %>
<% if @profile.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@profile.errors.count, "error") %> prohibited this profile from being saved:</h2>
<ul>
<% @profile.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
Education
<%= fields_for @profile.education do |e| %>
<%= e.label :name %><br />
<%= e.text_field :name %>
<% end %>
</div>
<% if false %>
<div class="field">
Experience
<%= f.label :experience %><br />
<%= f.text_field :experience %>
</div>
<div class="field">
Published Work
<%= f.label :published_work %><br />
<%= f.text_field :published_work %>
</div>
<div class="field">
Honor
<%= f.label :honor %><br />
<%= f.text_area :honor %>
</div>
<div class="field">
Activity
<%= f.label :activity %><br />
<%= f.text_area :activity %>
</div>
<div class="field">
Certification
<%= f.label :certification %><br />
<%= f.text_area :certification %>
</div>
<div class="field">
Skill
<%= f.label :skill %><br />
<%= f.text_area :skill %>
</div>
<% end %>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
# profile.rb
class Profile < ActiveRecord::Base
belongs_to :user
has_many :educations
has_many :experiences
has_many :published_works
has_many :honors
has_many :activities
has_many :certifications
has_many :skills
end
# education.rb
class Education < ActiveRecord::Base
belongs_to :profile
end
# education
name:string
start:date
end:date
profile:references
degree:string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment