I have a edit form for a model that also edits all child object in a
has_many relation.
The form is like this:
--------------------------------------
<%= error_messages_for ''roteiro'' %>
<!--[form:roteiro]-->
<p><label
for="roteiro_titulo">Titulo</label><br/>
<%= text_field ''roteiro'', ''titulo'', {
:size => 50 } %></p>
<p><label
for="roteiro_lugares">Lugares</label><br/>
<%= text_field ''roteiro'', ''lugares'', {
:size => 5 } %></p>
<table>
<%
for @tipo in @roteiro.roteiro_tipos
-%>
<tr>
<td><%= text_field ''tipo[]'',
''titulo'' %></td>
<td><%= text_field ''tipo[]'',
''preco'' %></td>
<td><%= text_field ''tipo[]'',
''lugares'' %></td>
</tr>
<% end %>
</table>
<!--[eoform:roteiro]-->
--------------------------------------
The problem is that the validation messages for the child objects
doesn''t
show up in the page.
How can I make it appear in the same page?
Thanks.
Erick
I have a edit form for a model that also edits all child object in a
has_many relation.
The form is like this:
--------------------------------------
<%= error_messages_for ''roteiro'' %>
<!--[form:roteiro]-->
<p><label
for="roteiro_titulo">Titulo</label><br/>
<%= text_field ''roteiro'', ''titulo'', {
:size => 50 } %></p>
<p><label
for="roteiro_lugares">Lugares</label><br/>
<%= text_field ''roteiro'', ''lugares'', {
:size => 5 } %></p>
<table>
<%
for @tipo in @roteiro.roteiro_tipos
-%>
<tr>
<td><%= text_field ''tipo[]'',
''titulo'' %></td>
<td><%= text_field ''tipo[]'',
''preco'' %></td>
<td><%= text_field ''tipo[]'',
''lugares'' %></td>
</tr>
<% end %>
</table>
<!--[eoform:roteiro]-->
--------------------------------------
The problem is that the validation messages for the child objects
doesn''t
show up in the page.
How can I make it appear in the same page?
Thanks.
Erick
_______________________________________________________
Promoo Yahoo! Acesso Grtis: a cada hora navegada voc acumula cupons e concorre a
mais de 500 prmios! Participe! http://yahoo.fbiz.com.br/
Try this:
<% @roteiro.roteiro_tipos.each do |tipo| -%>
<% @tipo = tipo -%>
<%= error_messages_for ''tipo'' %>
<tr>
<td><%= text_field ''tipo[]'',
''titulo'' %></td>
<td><%= text_field ''tipo[]'',
''preco'' %></td>
<td><%= text_field ''tipo[]'',
''lugares'' %></td>
</tr>
<% end %>
On 10/8/05, Erick Sasse
<erick.sasse-LIimvLsScs9wFqzsTH5u/w@public.gmane.org>
wrote:> I have a edit form for a model that also edits all child object in a
> has_many relation.
> The form is like this:
>
> --------------------------------------
> <%= error_messages_for ''roteiro'' %>
>
> <!--[form:roteiro]-->
> <p><label
for="roteiro_titulo">Titulo</label><br/>
> <%= text_field ''roteiro'', ''titulo'',
{ :size => 50 } %></p>
>
> <p><label
for="roteiro_lugares">Lugares</label><br/>
> <%= text_field ''roteiro'', ''lugares'',
{ :size => 5 } %></p>
>
> <table>
> <%
> for @tipo in @roteiro.roteiro_tipos
> -%>
> <tr>
> <td><%= text_field ''tipo[]'',
''titulo'' %></td>
> <td><%= text_field ''tipo[]'',
''preco'' %></td>
> <td><%= text_field ''tipo[]'',
''lugares'' %></td>
> </tr>
> <% end %>
> </table>
>
> <!--[eoform:roteiro]-->
> --------------------------------------
>
> The problem is that the validation messages for the child objects
doesn''t
> show up in the page.
> How can I make it appear in the same page?
>
> Thanks.
> Erick
>
>
>
>
>
>
> _______________________________________________________
> Promoção Yahoo! Acesso Grátis: a cada hora navegada você acumula cupons e
concorre a mais de 500 prêmios! Participe! http://yahoo.fbiz.com.br/
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
> Try this: > > <% @roteiro.roteiro_tipos.each do |tipo| -%> > <% @tipo = tipo -%> > <%= error_messages_for ''tipo'' %> > <tr> > <td><%= text_field ''tipo[]'', ''titulo'' %></td> > <td><%= text_field ''tipo[]'', ''preco'' %></td> > <td><%= text_field ''tipo[]'', ''lugares'' %></td> > </tr> > <% end %>Didn''t work. :( -- Erick Sasse _______________________________________________________ Promoo Yahoo! Acesso Grtis: a cada hora navegada voc acumula cupons e concorre a mais de 500 prmios! Participe! http://yahoo.fbiz.com.br/