2009/6/11 Tyler Knappe <[email protected]>:
>
> Xavier Noria wrote:
>> On Thu, Jun 11, 2009 at 10:19 PM, Tyler
>> Knappe<[email protected]> wrote:
>>
>> If the real code is different please paste it.
>
> Here is the code:
>
> session[:next_week] = Date.today.cweek
>
>        render :update do |page|
>                page["Current_Week_div_1"].replace_html
> session[:next_week].to_s
>                page["Week_div"].replace_html session[:next_week].to_s
>                page["test_div_1"].replace_html "Test 1"
>                page["test_div_2"].replace_html "Test 2"
>                page["test_div_3"].replace_html "Test 3"
>                page["test_div_4"].replace_html "Test 4"
>                page["test_div_5"].replace_html "Test 5"
>                page["test_div_6"].replace_html "Test 6"
>                page["test_div_7"].replace_html "Test 7"
>                for i in 0..23 do
>                        for j in 0..6 do
>                                if
> (Date.today.beginning_of_week.to_time.to_i + ( j * 86400) + ( i * 3600)
> +  ((session[:next_week] - session[:current_week]) * 7 * 86400 )) <
> (session[:lab_object].end_time.to_time.to_i) &&
> (Date.today.beginning_of_week.to_time.to_i + ( j * 86400) + ( i * 3600)
> + ((session[:next_week] - session[:current_week]) * 7 * 86400 )) >
> (session[:lab_object].start_time.to_time.to_i - 3600)
>                                        page["test_div"].replace_html
> "Checked Out"
>                                else
>                                        page["test_div"].replace_html
> "Available"
>                                end
>                        end
>                end
>        end
>
> Executing this code only updates a single element.

I am presumably missing something here, as I do not know much about
RJS, but inside the loop you seem to be replacing the html for the
same div ("test_div") every time round the loop.

Colin

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to