Ruby on Rails
Saturday, May 14, 2016
Hi all,
-- this form will not display the nested part when it fails validation.
What is really throwing me in a loop is that if eliminate one of the ":include_blank => true"
it works.
I have tried changing them to text_field and it fails also.
Thanks for you help in advance.
-Luis
class Elig < ActiveRecord::Base
belongs_to :patient
validates_presence_of :contract, :effective
end
class Patient < ActiveRecord::Base
has_one :elig
validates_presence_of :dob, :name, :last
validates :name, uniqueness: {scope: [:name, :last, :dob]}
validates_associated :elig
end
= form_for(@patient) do |f|
- if @patient.errors.any?
%h2
= pluralize(@patient.errors.count, "error")
prohibited this patient from being saved:
%ul
- @patient.errors.full_messages.each do |msg|
%li= msg
.field
=f.label :Name
= f.text_field :name
/more text_field/
/---------------/
%br
=f.fields_for :elig do |e|
%br
= e.label :Efective
= e.date_select :effective, start_year: Date.today.year,order: [:day,:month, :year], :include_blank => true
%br
= e.label :Termination
= e.date_select :termination, start_year: Date.today.year,order: [:day,:month, :year], :include_blank => true
%br
= e.label :Renewal
= e.date_select :renewal, start_year: Date.today.year,order: [:day,:month, :year], :include_blank => true
%br
= e.label :Contract
= e.text_field :contract
%br
.actions
= f.submit
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/a81c5dd6-2a8c-4909-8d56-9f008876df5d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment