Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
b1f140ef
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
b1f140ef
编写于
11月 26, 2017
作者:
K
Kasper Timm Hansen
提交者:
GitHub
11月 26, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #31229 from y-yagi/remove_field_ids_from_scaffold_form
Remove field ids from scaffold form
上级
d7ab5710
fbb8b373
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
7 addition
and
11 deletion
+7
-11
railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt
...rails/generators/erb/scaffold/templates/_form.html.erb.tt
+3
-3
railties/lib/rails/generators/named_base.rb
railties/lib/rails/generators/named_base.rb
+0
-4
railties/test/generators/scaffold_generator_test.rb
railties/test/generators/scaffold_generator_test.rb
+4
-4
未找到文件。
railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt
浏览文件 @
b1f140ef
...
...
@@ -15,15 +15,15 @@
<div class="field">
<% if attribute.password_digest? -%>
<%%= form.label :password %>
<%%= form.password_field :password
, id: :<%= field_id(:password) %>
%>
<%%= form.password_field :password %>
</div>
<div class="field">
<%%= form.label :password_confirmation %>
<%%= form.password_field :password_confirmation
, id: :<%= field_id(:password_confirmation) %>
%>
<%%= form.password_field :password_confirmation %>
<% else -%>
<%%= form.label :<%= attribute.column_name %> %>
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>
, id: :<%= field_id(attribute.column_name) %>
%>
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %> %>
<% end -%>
</div>
...
...
railties/lib/rails/generators/named_base.rb
浏览文件 @
b1f140ef
...
...
@@ -114,10 +114,6 @@ def new_helper # :doc:
"new_
#{
singular_route_name
}
_url"
end
def
field_id
(
attribute_name
)
[
singular_table_name
,
attribute_name
].
join
(
"_"
)
end
def
singular_table_name
# :doc:
@singular_table_name
||=
(
pluralize_table_names?
?
table_name
.
singularize
:
table_name
)
end
...
...
railties/test/generators/scaffold_generator_test.rb
浏览文件 @
b1f140ef
...
...
@@ -471,8 +471,8 @@ def test_scaffold_generator_belongs_to
end
assert_file
"app/views/accounts/_form.html.erb"
do
|
content
|
assert_match
(
/^\W{4}<%= form\.text_field :name
, id: :account_name
%>/
,
content
)
assert_match
(
/^\W{4}<%= form\.text_field :currency_id
, id: :account_currency_id
%>/
,
content
)
assert_match
(
/^\W{4}<%= form\.text_field :name %>/
,
content
)
assert_match
(
/^\W{4}<%= form\.text_field :currency_id %>/
,
content
)
end
end
...
...
@@ -495,8 +495,8 @@ def test_scaffold_generator_password_digest
end
assert_file
"app/views/users/_form.html.erb"
do
|
content
|
assert_match
(
/<%= form\.password_field :password
, id: :user_password
%>/
,
content
)
assert_match
(
/<%= form\.password_field :password_confirmation
, id: :user_password_confirmation
%>/
,
content
)
assert_match
(
/<%= form\.password_field :password %>/
,
content
)
assert_match
(
/<%= form\.password_field :password_confirmation %>/
,
content
)
end
assert_file
"app/views/users/index.html.erb"
do
|
content
|
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录