给出下面的一行代码 routes.rb
map.resources :users
Run Code Online (Sandbox Code Playgroud)
生成的路由可能是这样的:
users GET /users(.:format) {:controller=>"users", :action=>"index"}
POST /users(.:format) {:controller=>"users", :action=>"create"}
new_user GET /users/new(.:format) {:controller=>"users", :action=>"new"}
edit_user GET /users/:id/edit(.:format) {:controller=>"users", :action=>"edit"}
user GET /users/:id(.:format) {:controller=>"users", :action=>"show"}
PUT /users/:id(.:format) {:controller=>"users", :action=>"update"}
DELETE /users/:id(.:format) {:controller=>"users", :action=>"destroy"}
Run Code Online (Sandbox Code Playgroud)
有没有办法将POST /users映射的默认HTTP方法更改{:controller=>"users", :action=>"create"}为用于PUT替代的HTTP方法?
rake routes 然后生成这样的东西:
users GET /users(.:format) {:controller=>"users", :action=>"index"}
PUT /users(.:format) {:controller=>"users", :action=>"create"}
new_user GET /users/new(.:format) {:controller=>"users", :action=>"new"}
edit_user GET /users/:id/edit(.:format) {:controller=>"users", :action=>"edit"}
user GET /users/:id(.:format) {:controller=>"users", :action=>"show"}
PUT /users/:id(.:format) {:controller=>"users", :action=>"update"}
DELETE /users/:id(.:format) {:controller=>"users", …Run Code Online (Sandbox Code Playgroud) 我正在尝试提出一个正则表达式,它将匹配一个字符串中的分数(1/2)而不是日期(5/5/2005).任何帮助都会很棒,所有我能想到的是(\ d +)/(\ d +),它们在两个字符串中找到匹配项.在此先感谢您的帮助.
我有一个简单的表单,如下所示,我已将jQuery验证插件添加到(http://docs.jquery.com/Plugins/Validation).我在一个模态弹出窗口中有这个表单,所以如果有错误并且用户在再次打开它时关闭窗口,表单仍然有错误.在我的弹出关闭回调中,我尝试调用resetForm(),但它说该方法不存在.
表单HTML:
<form class="validations" id="commentForm" method="get" action="">
<p>
<label for="name">Name</label>
<em>*</em><input id="name" name="name" size="25" class="required" minlength="2" />
</p>
<p>
<label for="email">E-Mail</label>
<em>*</em><input id="email" name="email" size="25" class="required email" />
</p>
</form>
Run Code Online (Sandbox Code Playgroud)
弹出关闭回调:
function(){
$(this).find('form.validations').resetForm();
}
Run Code Online (Sandbox Code Playgroud)
在此先感谢您的帮助.
我有一些非常简单的HTML和CSS在Internet Explorer 6中不起作用.
<!DOCTYPE HTML>
<html>
<head>
<style>
table td.one.read {background-color:#FFD700;}
table td.two.read {background-color:#0000ff;}
table td.three.read {background-color:#ff8c00;}
</style>
</head>
<body>
<table>
<tr class="head">
<td></td>
<td class='one read'>one</td>
<td class='two read'>two</td>
<td class='three read'>three</td>
</tr>
<tr>
<td>Legend</td>
<td class='one read'>1</td>
<td class='two read'>2</td>
<td class='three read'>3</td>
</tr>
</table>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
一个简单的表,每列具有不同的背景颜色.我删除了一堆其他的CSS/HTML以保持简单.问题是所有列在Internet Explorer 6中显示为相同的橙色,在Firefox中工作正常.
我怎样才能使它工作?
css ×1
html ×1
html-table ×1
javascript ×1
jquery ×1
regex ×1
reset ×1
resources ×1
rest ×1
routing ×1
validation ×1