Displaying 2 results from an estimated 2 matches for "prg_name".
Did you mean:
pkg_name
2006 Feb 02
4
Doubts on validation
...;
=> 40 %></td>
</tr>
<tr>
<td><b>Program: </b></td>
<td><select id="student_program_id" name="student[program_id]">
<%= options_from_collection_for_select @programs, "id",
"prg_name", @student.program_id %>
</select>
</td>
</tr>
Model
*******
class Student < ActiveRecord::Base
belongs_to :program
validates_presence_of :fname, :program
end
When I have the dropdown list with the available programs, the
application do...
2006 Feb 02
0
Validation fails with select option list
...name" name="student[lname]" size="20" value=""
type="text">
Program:</dt><dd><select id="student_program_id"
name="student[program_id]">
<%= options_from_collection_for_select @programs, "id", "prg_name",
@student.program_id %>
</select>
I am not able to use validates_presence_of in the model whenever I am
including this options_from_collection_for_select list. If I remove that
it checks for the presence of the field. Otherwise, it gives me the
following error
You have a nil object...