The Depot Application

The Depot Application

23.7 Working with Nonmodel Fields 23.5 Forms That Wrap Model Objects

23.6 Custom Form Builders

cp -vr /home/rubys/git/awdwr/edition3/data/code/e1/views/app/helpers/tagged_builder.rb app/helpers
`/home/rubys/git/awdwr/edition3/data/code/e1/views/app/helpers/tagged_builder.rb' -> `app/helpers/tagged_builder.rb'
cp -vr /home/rubys/git/awdwr/edition3/data/code/e1/views/app/views/builder app/views
`/home/rubys/git/awdwr/edition3/data/code/e1/views/app/views/builder' -> `app/views/builder'
`/home/rubys/git/awdwr/edition3/data/code/e1/views/app/views/builder/new.html.erb' -> `app/views/builder/new.html.erb'
`/home/rubys/git/awdwr/edition3/data/code/e1/views/app/views/builder/new_with_helper.html.erb' -> `app/views/builder/new_with_helper.html.erb'
cp -vr /home/rubys/git/awdwr/edition3/data/code/e1/views/app/helpers/builder_helper.rb app/helpers
`/home/rubys/git/awdwr/edition3/data/code/e1/views/app/helpers/builder_helper.rb' -> `app/helpers/builder_helper.rb'
cp -vr /home/rubys/git/awdwr/edition3/data/code/e1/views/app/views/array app/views
`/home/rubys/git/awdwr/edition3/data/code/e1/views/app/views/array' -> `app/views/array'
`/home/rubys/git/awdwr/edition3/data/code/e1/views/app/views/array/edit.html.erb' -> `app/views/array/edit.html.erb'
edit app/views/builder/new.html.erb
<%= form_for :product, :url => { :action => :save },
                      :builder => TaggedBuilder do |form| %>
  <%= form.text_field 'title'  %>
  <%= form.text_area  'description'  %>
  <%= form.text_field 'image_url'  %>
  <%= submit_tag %>
<% end %>
edit app/views/builder/new_with_helper.html.erb
<%= tagged_form_for :product, :url => { :action => :save } do |form| %>
  <%= form.text_field 'title'  %>
  <%= form.text_area  'description'  %>
  <%= form.text_field 'image_url'  %>
  <%= submit_tag %>
<% end %>
edit app/views/array/edit.html.erb
<% form_tag do %>
  <% for @product in @products %>
    <%= text_field("product[]", 'image_url') %><br />
  <% end %>
  <%= submit_tag %>
<% end %>
get /builder/new

<br/>

<br/>

<br/>

get /builder/new_with_helper

<br/>

<br/>

<br/>

get /array/edit

23.7 Working with Nonmodel Fields 23.5 Forms That Wrap Model Objects