this validation in my model only works for the first nested model.
Why is that?
def treatment_must_have_preptype
errors.add(:preptype,
I18n.translate(''activerecord.errors.messages.nestedTrempty''))
if
treatment_preptype_empty?
end
def treatment_preptype_empty?
if !treatments.empty?
treatments.all? {|treatment| treatment[''preptype''].blank?
}
end
end
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
I use javascript to insert a nested model form into a page. If I use validation on the data entered and it reloads the page with an error displayed, the nested model form is gone because it''s not part of the original template. Is there any way I can change it? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hell Mlle, have you found a solution? I have the same exact problem... On Jun 1, 9:45 pm, Mlle <emsto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I use javascript to insert a nested model form into a page. If I use > validation on the data entered and it reloads the page with an error > displayed, the nested model form is gone because it''s not part of the > original template. > > Is there any way I can change it?-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.