2009/2/13 cool <[email protected]>:
>
> Here is my code,
>
> can u check once,
>
>  <% @class.each do |f| %>
>                <% if f.role == "class_teacher" %>
>                      <li>
>                          <label><%= f.role.titleize %></label>
>                          <%= select :name => "class[people]
> [teacher]", :collection => @current_school.staff.find(:all), :selected
> => f.person_id.to_s, :value_method => :id, :text_method
> => :name, :prompt => "Select Faculty" %>
>                      </li>
>
>
> can u check once. plz

As far as I can see this looks like it should work.  The only thing I
can think of where there would be a problem is if the f.person_id
value you're passing as :selected to the select method isn't what you
expect it to be.  You could check this by printing out the value to
your console just to check - something like:

<% @class.each do |f| %>
  <% puts "CLASS PERSON ID: #{f.person_id}" %>
  <% if f.role == "class_teacher" %>
  ........

and check the console output when you load the page that's not working
as expected.  If it prints out nil or 0 or a number that isn't one of
the @current_school.staff ids then it won't be selected.  Apart from
that I can't really see anything wrong with what you're doing.

Rupert

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"merb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/merb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to