Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
810dff7c
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,发现更多精彩内容 >>
提交
810dff7c
编写于
9月 02, 2016
作者:
X
Xavier Noria
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
RuboCop is 100% green
🎉
上级
11eaf1c1
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
53 addition
and
44 deletion
+53
-44
actionmailer/lib/action_mailer/preview.rb
actionmailer/lib/action_mailer/preview.rb
+5
-4
actionpack/lib/action_controller/metal/implicit_render.rb
actionpack/lib/action_controller/metal/implicit_render.rb
+1
-1
actionpack/lib/action_dispatch/routing/route_set.rb
actionpack/lib/action_dispatch/routing/route_set.rb
+11
-10
actionview/lib/action_view/helpers/date_helper.rb
actionview/lib/action_view/helpers/date_helper.rb
+7
-6
activemodel/lib/active_model/type/helpers/numeric.rb
activemodel/lib/active_model/type/helpers/numeric.rb
+1
-1
activemodel/lib/active_model/type/immutable_string.rb
activemodel/lib/active_model/type/immutable_string.rb
+1
-1
activerecord/lib/active_record/reflection.rb
activerecord/lib/active_record/reflection.rb
+13
-12
activesupport/test/core_ext/duration_test.rb
activesupport/test/core_ext/duration_test.rb
+5
-1
guides/rails_guides/markdown/renderer.rb
guides/rails_guides/markdown/renderer.rb
+9
-8
未找到文件。
actionmailer/lib/action_mailer/preview.rb
浏览文件 @
810dff7c
...
...
@@ -34,11 +34,12 @@ def register_preview_interceptors(*interceptors)
# Either a class or a string can be passed in as the Interceptor. If a
# string is passed in it will be <tt>constantize</tt>d.
def
register_preview_interceptor
(
interceptor
)
preview_interceptor
=
case
interceptor
when
String
,
Symbol
interceptor
.
to_s
.
camelize
.
constantize
preview_interceptor
=
\
case
interceptor
when
String
,
Symbol
interceptor
.
to_s
.
camelize
.
constantize
else
interceptor
interceptor
end
unless
preview_interceptors
.
include?
(
preview_interceptor
)
...
...
actionpack/lib/action_controller/metal/implicit_render.rb
浏览文件 @
810dff7c
...
...
@@ -62,7 +62,7 @@ def default_render(*args)
def
method_for_action
(
action_name
)
super
||
if
template_exists?
(
action_name
.
to_s
,
_prefixes
)
"default_render"
end
end
end
private
...
...
actionpack/lib/action_dispatch/routing/route_set.rb
浏览文件 @
810dff7c
...
...
@@ -282,16 +282,17 @@ def define_url_helper(mod, route, name, opts, route_key, url_strategy)
mod
.
module_eval
do
define_method
(
name
)
do
|*
args
|
last
=
args
.
last
options
=
case
last
when
Hash
args
.
pop
when
ActionController
::
Parameters
if
last
.
permitted?
args
.
pop
.
to_h
else
raise
ArgumentError
,
ActionDispatch
::
Routing
::
INSECURE_URL_PARAMETERS_MESSAGE
end
end
options
=
\
case
last
when
Hash
args
.
pop
when
ActionController
::
Parameters
if
last
.
permitted?
args
.
pop
.
to_h
else
raise
ArgumentError
,
ActionDispatch
::
Routing
::
INSECURE_URL_PARAMETERS_MESSAGE
end
end
helper
.
call
self
,
args
,
options
end
end
...
...
actionview/lib/action_view/helpers/date_helper.rb
浏览文件 @
810dff7c
...
...
@@ -1011,12 +1011,13 @@ def build_select(type, select_options_as_html)
# css_class_attribute(:year, 'date optional', { year: 'my-year' })
# => "date optional my-year"
def
css_class_attribute
(
type
,
html_options_class
,
options
)
# :nodoc:
css_class
=
case
options
when
Hash
options
[
type
.
to_sym
]
else
type
end
css_class
=
\
case
options
when
Hash
options
[
type
.
to_sym
]
else
type
end
[
html_options_class
,
css_class
].
compact
.
join
(
" "
)
end
...
...
activemodel/lib/active_model/type/helpers/numeric.rb
浏览文件 @
810dff7c
...
...
@@ -8,7 +8,7 @@ def cast(value)
when
false
then
0
when
::
String
then
value
.
presence
else
value
end
end
super
(
value
)
end
...
...
activemodel/lib/active_model/type/immutable_string.rb
浏览文件 @
810dff7c
...
...
@@ -21,7 +21,7 @@ def cast_value(value)
when
true
then
"t"
when
false
then
"f"
else
value
.
to_s
end
end
result
.
freeze
end
end
...
...
activerecord/lib/active_record/reflection.rb
浏览文件 @
810dff7c
...
...
@@ -14,18 +14,19 @@ module Reflection # :nodoc:
end
def
self
.
create
(
macro
,
name
,
scope
,
options
,
ar
)
klass
=
case
macro
when
:composed_of
AggregateReflection
when
:has_many
HasManyReflection
when
:has_one
HasOneReflection
when
:belongs_to
BelongsToReflection
else
raise
"Unsupported Macro:
#{
macro
}
"
end
klass
=
\
case
macro
when
:composed_of
AggregateReflection
when
:has_many
HasManyReflection
when
:has_one
HasOneReflection
when
:belongs_to
BelongsToReflection
else
raise
"Unsupported Macro:
#{
macro
}
"
end
reflection
=
klass
.
new
(
name
,
scope
,
options
,
ar
)
options
[
:through
]
?
ThroughReflection
.
new
(
reflection
)
:
reflection
...
...
activesupport/test/core_ext/duration_test.rb
浏览文件 @
810dff7c
...
...
@@ -208,7 +208,11 @@ def test_to_json
end
def
test_case_when
cased
=
case
1
.
day
when
1
.
day
then
"ok"
end
cased
=
\
case
1
.
day
when
1
.
day
"ok"
end
assert_equal
cased
,
"ok"
end
...
...
guides/rails_guides/markdown/renderer.rb
浏览文件 @
810dff7c
...
...
@@ -67,14 +67,15 @@ def convert_notes(body)
# as a list item, but as a paragraph starting with a plain
# asterisk.
body
.
gsub
(
/^(TIP|IMPORTANT|CAUTION|WARNING|NOTE|INFO|TODO)[.:](.*?)(\n(?=\n)|\Z)/m
)
do
css_class
=
case
$1
when
"CAUTION"
,
"IMPORTANT"
"warning"
when
"TIP"
"info"
else
$1
.
downcase
end
css_class
=
\
case
$1
when
"CAUTION"
,
"IMPORTANT"
"warning"
when
"TIP"
"info"
else
$1
.
downcase
end
%(<div class="#{css_class}"><p>#{$2.strip}</p></div>)
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录