github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

alloy / complex-form-examples forked from ryanb/complex-form-examples

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 229
    • 18
  • Source
  • Commits
  • Network (18)
  • Issues (3)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Tree: a234fde

click here to add a description

click here to add a homepage

  • Branches (2)
    • integration
    • master
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Simple Rails application which shows the use of NestedAttributes and AutosaveAssociation. — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Updated code to use accepts_nested_attributes_for instead of 
accept_nested_attributes_for. Comment
alloy (author)
Tue Jan 27 02:32:45 -0800 2009
commit  a234fde4419836f277d7e340657f1d8418911d68
tree    8524c4b508351c542e5545d7903b82a450a7a5d2
parent  673f1ad3e30c680a07425dad61ca87e05e8f887b
complex-form-examples / app / views / projects / _form.html.erb app/views/projects/_form.html.erb
100644 70 lines (57 sloc) 1.986 kb
edit raw blame history
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<% javascript :defaults %>
 
<%= error_messages_for :project %>
 
<% form_for @project do |project_form| -%>
 
  <p>
    <%= project_form.label :name, "Project:" %>
    <%= project_form.text_field :name %>
  </p>
  
  <p>
    <% project_form.fields_for :author do |author_form| %>
      <%= author_form.label :name, "Author name:" %>
      <%= author_form.text_field :name %>
      
      <%= author_form.label :raise_exception, "Raise exception:" %>
      <%= author_form.check_box :raise_exception %>
    <% end %>
  </p>
  
  <div id="tasks">
    <% project_form.fields_for :tasks do |task_form| %>
      <div class="task">
        <p>
          <%= task_form.label :name, "Task:" %>
          <%= task_form.text_field :name %>
          
          <%= task_form.label :raise_exception, "Raise exception:" %>
          <%= task_form.check_box :raise_exception %>
          
          <!-- Uses JS to hide this `task' and set a hidden_field with the name
`_delete' to "1" which causes the record to be deleted. -->
          <%= remove_link_unless_new_record(task_form) %>
        </p>
      </div>
    <% end %>
  </div>
  <p>
    <%= add_task_link "Add a task", project_form %>
  </p>
  
  <div id="tags">
    <% project_form.fields_for :tags do |tag_form| %>
      <div class="tag">
        <p>
          <%= tag_form.label :name, "Tag:" %>
          <%= tag_form.text_field :name %>
          
          <%= tag_form.label :raise_exception, "Raise exception:" %>
          <%= tag_form.check_box :raise_exception %>
          
          <% unless tag_form.object.new_record? %>
            <!-- For existing records we add a checkbox to be able to delete records. -->
            <%= tag_form.label :_delete, "Remove:" %>
            <%= tag_form.check_box :_delete %>
          <% end %>
        </p>
      </div>
    <% end %>
  </div>
  <p>
    <%= add_tag_link "Add a tag", project_form %>
  </p>
  
  <p>
    <%= project_form.submit "Submit" %>
  </p>
<% end -%>
 
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server