Forum: Rails-ES PROBLEMA CON .BUILD

Posted by David J,nas (acidburg)
on 2009-07-03 11:52
PACIENTES ALERGIAS CONTROLLER
def new
 @alergias_paciente = AlergiasPaciente.new
  3.times { @alergias_paciente.alergia.build }
end
pacientes alergias model
belongs_to :alergias
belogns_to :paciente

paciente model
has_many :pacientes_alergias

alergias
has_many :pacientes_alergias

 NoMethodError in Alergias pacientesController#new

You have a nil object when you didn't expect it!
The error occurred while evaluating nil.build

RAILS_ROOT: /home/acidburg/workspace/padreConcha
Application Trace | Framework Trace | Full Trace

app/controllers/alergias_pacientes_controller.rb:28:in `new'
app/controllers/alergias_pacientes_controller.rb:28:in `times'
app/controllers/alergias_pacientes_controller.rb:28:in `new'



lo que quiero es hacer un formulario que pueda agregar alergias a un
paciente con javascript es decir k le de a agregar alergia i me salga
otro recuadro para completari luego las agregue todas de golpe
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.