Skip to content

Instantly share code, notes, and snippets.

Created February 10, 2011 10:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/820315 to your computer and use it in GitHub Desktop.
Save anonymous/820315 to your computer and use it in GitHub Desktop.
- nested_form_for(@exercise) do |f|
- if @exercise.errors.any?
#error_explanation
%h2
= pluralize(@exercise.errors.count, "error")
prohibited this exercise from being saved:
%ul
- @exercise.errors.full_messages.each do |msg|
%li= msg
.field
= f.label :name
%br/
= f.text_field :name
%p
%b Target(s):
- f.fields_for :muscles do |e|
= e.collection_select :id, Muscle.all, :id, :name
= e.link_to_remove "-remove"
= f.link_to_add "Add target muscle", :muscles
.field
= f.label :description
%br/
= f.text_area :description
.field
= f.label :preparation
%br/
= f.text_area :preparation
.field
= f.label :execution
%br/
= f.text_area :execution
.field
= f.label :comment
%br/
= f.text_area :comment
.field
= f.label :url
%br/
= f.text_field :url
.field
= f.label :exercise_type
%br/
= f.collection_select :exercise_type_id, ExerciseType.all, :id, :name
.actions
= f.submit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment