Formtastic can add new records via a has_many, although I guess you still need 
JavaScript to add more than one at once.

class RecipesController < ApplicationController
  def edit
    @recipe = Recipe.find(params[:id])
    @recipe.ingredients.build
  end
end

class Recipe < ActiveRecord::Base
  accepts_nested_attributes_for :ingredients
end

<%= semantic_form_for @recipe do |ref| %>
  <%= ref.semantic_fields_for(:ingredients) do |inf| %>
    <%= inf.input :quantity %>
  <% end %>
<% end %>


On 24/04/2010, at 4:59 PM, Daniel wrote:

> I've been looking for a good JS dynamic form solution, and it doesn't
> look like there's anything great out there for complex forms
> (formtastic is handy until you need to create new records via a
> has_many - but then you're back to adding lines via custom JS).

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
or Rails Oceania" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en.

Reply via email to