0
我需要得到像我的問題24-02-11(更新的desc)的最後日期時間,但通過JavaScript。我的方式不起作用,但$ time或$ all_users完美工作。如何獲取最後的記錄? (JS)
my_controller
$all_users = User.count('id')
$last_question = Question.find(:last, :order => "updated_at DESC", :limit => 1)
$time = Time.now.strftime("%d %B, %Y")
my_layout_view
<% javascript_tag do %>
Ext.BLANK_IMAGE_URL = '<%= image_path '/ext/resources/images/default/s.gif' %>';
<%= "time = \"#{$time}\"" %>;
<%= "last_question = \"#{$last_question}\"" %>;
<% end %>
my_view
..........
items : [
{
region : 'north',
minWidth : 75,
height : 35,
maxWidth : 150,
collapsible : false,
resizable : false,
width : 400,
html : 'Last question was:' <b> + last_question + '</b>',
}
.......................
btw,你爲什麼使用全局變量? – 2011-04-15 14:12:31
嗯,我還能怎麼樣? – 2011-04-15 14:21:03
噢,我明白了:)全局變量很難使用? – 2011-04-15 14:22:11