Guys,
I got a big problem, badly i need a help in this issue.
class Assignment < ActiveRecord::Base
belongs_to :category
end
class Category < ActiveRecord::Base
belongs_to :report
has_many :assignments
end
The above are two models.
def new
@category = Category.new
#...@assignment = Assignment.new
5.times { @category.assignments.build }
end
Here is the view
<div id="idone">
<%= fields_for @category do %>
<ul>
<li><label>Category(optional)</label><li>
<li><%= text_field :category_name %></li>
<% for assignment in @category.assignments
%>
<%= fields_for @assignment do %>
<li>
<%= text_field :name =>
"name[]", :class => "short" %>
<%= text_field :name =>
"date[]", :class => "short apart" %>
<%= text_field :name =>
"max_point[]", :class => "short apart" %>
</li>
<% end =%>
<% end %>
</ul>
<% end =%>
</div>
i have a link called add another category. If i click that link it
should add all the content (complete div)
how i can do that in java script or merb
it is becoming very tough for me
can u help me guys..
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"merb" 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/merb?hl=en
-~----------~----~----~----~------~----~------~--~---