>> Colin
>

Dear I changed the Days from names to numbers, in my Add_rosters its 
like below now:

<%= a.select :duty_day1, [[ "Monday","1"], 
["Tuesday","2"],["Wednesday","3"],["Thursday","4"],["Friday","5"],["Saturday","6"],["Sunday","0"]],:selected
 
=> ["Monday","1"]  %>


Change the controller's method to this:

def show_all_rosters
@theday =Time.now.strftime('%A').downcase
@rosterduties = RosterDuty.find(:all,:conditions=>["duty_day1 >= :theday 
and duty_day2 <=:theday",{:theday => @theday}])
end


and show_all_rosters view is this:

<div id="page-yield">
<% if @rosterduties.present? %>
  <% @rosterduties.each do |r| %>
  <%= r.duty_name %> <br />
  <%= r.duty_place %> <br />
  <%= r.duty_time %> <br />
  <%= r.duty_day1 %> <br />
  <%= r.duty_day2 %> <p>
  <%end%>
 <%end%>
</div>

But the result is blank.

-- 
Posted via http://www.ruby-forum.com/.

-- 
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+unsubscr...@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/20cb5baf7c9bffdc67fd76fa81da8982%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to