Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
6ff923a1
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,发现更多精彩内容 >>
提交
6ff923a1
编写于
6月 01, 2013
作者:
R
Rafael Mendonça França
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #10814 from kennyj/deprecations_4_1
Remove some deprecation methods / options / files.
上级
f2855f6e
d3e8c149
变更
25
隐藏空白更改
内联
并排
Showing
25 changed file
with
4 addition
and
479 deletion
+4
-479
actionpack/lib/action_controller.rb
actionpack/lib/action_controller.rb
+0
-4
actionpack/lib/action_controller/base.rb
actionpack/lib/action_controller/base.rb
+0
-1
actionpack/lib/action_controller/record_identifier.rb
actionpack/lib/action_controller/record_identifier.rb
+0
-31
actionpack/lib/action_controller/vendor/html-scanner.rb
actionpack/lib/action_controller/vendor/html-scanner.rb
+0
-5
actionpack/lib/action_view/helpers/form_tag_helper.rb
actionpack/lib/action_view/helpers/form_tag_helper.rb
+0
-41
actionpack/lib/action_view/helpers/javascript_helper.rb
actionpack/lib/action_view/helpers/javascript_helper.rb
+0
-42
actionpack/lib/action_view/helpers/url_helper.rb
actionpack/lib/action_view/helpers/url_helper.rb
+0
-18
actionpack/lib/action_view/template.rb
actionpack/lib/action_view/template.rb
+0
-6
actionpack/test/controller/base_test.rb
actionpack/test/controller/base_test.rb
+3
-29
actionpack/test/controller/record_identifier_test.rb
actionpack/test/controller/record_identifier_test.rb
+0
-34
actionpack/test/template/form_tag_helper_test.rb
actionpack/test/template/form_tag_helper_test.rb
+0
-28
actionpack/test/template/javascript_helper_test.rb
actionpack/test/template/javascript_helper_test.rb
+0
-42
actionpack/test/template/template_test.rb
actionpack/test/template/template_test.rb
+0
-7
actionpack/test/template/url_helper_test.rb
actionpack/test/template/url_helper_test.rb
+0
-75
activerecord/lib/active_record/relation/calculations.rb
activerecord/lib/active_record/relation/calculations.rb
+1
-9
activerecord/test/cases/associations/has_many_associations_test.rb
...ord/test/cases/associations/has_many_associations_test.rb
+0
-6
activerecord/test/cases/base_test.rb
activerecord/test/cases/base_test.rb
+0
-32
activerecord/test/cases/calculations_test.rb
activerecord/test/cases/calculations_test.rb
+0
-6
activesupport/lib/active_support/benchmarkable.rb
activesupport/lib/active_support/benchmarkable.rb
+0
-10
activesupport/lib/active_support/json/encoding.rb
activesupport/lib/active_support/json/encoding.rb
+0
-1
activesupport/lib/active_support/json/variable.rb
activesupport/lib/active_support/json/variable.rb
+0
-18
activesupport/lib/active_support/test_case.rb
activesupport/lib/active_support/test_case.rb
+0
-2
activesupport/lib/active_support/testing/pending.rb
activesupport/lib/active_support/testing/pending.rb
+0
-14
activesupport/test/json/encoding_test.rb
activesupport/test/json/encoding_test.rb
+0
-7
activesupport/test/test_case_test.rb
activesupport/test/test_case_test.rb
+0
-11
未找到文件。
actionpack/lib/action_controller.rb
浏览文件 @
6ff923a1
...
...
@@ -46,10 +46,6 @@ module ActionController
autoload
:TestCase
,
'action_controller/test_case'
autoload
:TemplateAssertions
,
'action_controller/test_case'
eager_autoload
do
autoload
:RecordIdentifier
end
def
self
.
eager_load!
super
ActionController
::
Caching
.
eager_load!
...
...
actionpack/lib/action_controller/base.rb
浏览文件 @
6ff923a1
...
...
@@ -223,7 +223,6 @@ def self.without_modules(*modules)
ForceSSL
,
Streaming
,
DataStreaming
,
RecordIdentifier
,
HttpAuthentication
::
Basic
::
ControllerMethods
,
HttpAuthentication
::
Digest
::
ControllerMethods
,
HttpAuthentication
::
Token
::
ControllerMethods
,
...
...
actionpack/lib/action_controller/record_identifier.rb
已删除
100644 → 0
浏览文件 @
f2855f6e
require
'action_view/record_identifier'
module
ActionController
module
RecordIdentifier
MODULE_MESSAGE
=
'Calling ActionController::RecordIdentifier.%s is deprecated and '
\
'will be removed in Rails 4.1, please call using ActionView::RecordIdentifier instead.'
INSTANCE_MESSAGE
=
'%s method will no longer be included by default in controllers '
\
'since Rails 4.1. If you would like to use it in controllers, please include '
\
'ActionView::RecordIdentifier module.'
def
dom_id
(
record
,
prefix
=
nil
)
ActiveSupport
::
Deprecation
.
warn
(
INSTANCE_MESSAGE
%
'dom_id'
)
ActionView
::
RecordIdentifier
.
dom_id
(
record
,
prefix
)
end
def
dom_class
(
record
,
prefix
=
nil
)
ActiveSupport
::
Deprecation
.
warn
(
INSTANCE_MESSAGE
%
'dom_class'
)
ActionView
::
RecordIdentifier
.
dom_class
(
record
,
prefix
)
end
def
self
.
dom_id
(
record
,
prefix
=
nil
)
ActiveSupport
::
Deprecation
.
warn
(
MODULE_MESSAGE
%
'dom_id'
)
ActionView
::
RecordIdentifier
.
dom_id
(
record
,
prefix
)
end
def
self
.
dom_class
(
record
,
prefix
=
nil
)
ActiveSupport
::
Deprecation
.
warn
(
MODULE_MESSAGE
%
'dom_class'
)
ActionView
::
RecordIdentifier
.
dom_class
(
record
,
prefix
)
end
end
end
actionpack/lib/action_controller/vendor/html-scanner.rb
已删除
100644 → 0
浏览文件 @
f2855f6e
require
'action_view/vendor/html-scanner'
require
'active_support/deprecation'
ActiveSupport
::
Deprecation
.
warn
'Vendored html-scanner was moved to action_view, please require "action_view/vendor/html-scanner" instead. '
+
'This file will be removed in Rails 4.1'
actionpack/lib/action_view/helpers/form_tag_helper.rb
浏览文件 @
6ff923a1
...
...
@@ -426,22 +426,6 @@ def radio_button_tag(name, value, checked = false, options = {})
def
submit_tag
(
value
=
"Save changes"
,
options
=
{})
options
=
options
.
stringify_keys
if
disable_with
=
options
.
delete
(
"disable_with"
)
message
=
":disable_with option is deprecated and will be removed from Rails 4.1. "
\
"Use 'data: { disable_with:
\'
Text
\'
}' instead."
ActiveSupport
::
Deprecation
.
warn
message
options
[
"data-disable-with"
]
=
disable_with
end
if
confirm
=
options
.
delete
(
"confirm"
)
message
=
":confirm option is deprecated and will be removed from Rails 4.1. "
\
"Use 'data: { confirm:
\'
Text
\'
}' instead'."
ActiveSupport
::
Deprecation
.
warn
message
options
[
"data-confirm"
]
=
confirm
end
tag
:input
,
{
"type"
=>
"submit"
,
"name"
=>
"commit"
,
"value"
=>
value
}.
update
(
options
)
end
...
...
@@ -488,22 +472,6 @@ def button_tag(content_or_options = nil, options = nil, &block)
options
||=
{}
options
=
options
.
stringify_keys
if
disable_with
=
options
.
delete
(
"disable_with"
)
message
=
":disable_with option is deprecated and will be removed from Rails 4.1. "
\
"Use 'data: { disable_with:
\'
Text
\'
}' instead."
ActiveSupport
::
Deprecation
.
warn
message
options
[
"data-disable-with"
]
=
disable_with
end
if
confirm
=
options
.
delete
(
"confirm"
)
message
=
":confirm option is deprecated and will be removed from Rails 4.1. "
\
"Use 'data: { confirm:
\'
Text
\'
}' instead'."
ActiveSupport
::
Deprecation
.
warn
message
options
[
"data-confirm"
]
=
confirm
end
options
.
reverse_merge!
'name'
=>
'button'
,
'type'
=>
'submit'
content_tag
:button
,
content_or_options
||
'Button'
,
options
,
&
block
...
...
@@ -541,15 +509,6 @@ def button_tag(content_or_options = nil, options = nil, &block)
# # => <input alt="Save" src="/images/save.png" data-confirm="Are you sure?" type="image" />
def
image_submit_tag
(
source
,
options
=
{})
options
=
options
.
stringify_keys
if
confirm
=
options
.
delete
(
"confirm"
)
message
=
":confirm option is deprecated and will be removed from Rails 4.1. "
\
"Use 'data: { confirm:
\'
Text
\'
}' instead'."
ActiveSupport
::
Deprecation
.
warn
message
options
[
"data-confirm"
]
=
confirm
end
tag
:input
,
{
"alt"
=>
image_alt
(
source
),
"type"
=>
"image"
,
"src"
=>
path_to_image
(
source
)
}.
update
(
options
)
end
...
...
actionpack/lib/action_view/helpers/javascript_helper.rb
浏览文件 @
6ff923a1
...
...
@@ -70,48 +70,6 @@ def javascript_tag(content_or_options_with_block = nil, html_options = {}, &bloc
def
javascript_cdata_section
(
content
)
#:nodoc:
"
\n
//
#{
cdata_section
(
"
\n
#{
content
}
\n
//"
)
}
\n
"
.
html_safe
end
# Returns a button whose +onclick+ handler triggers the passed JavaScript.
#
# The helper receives a name, JavaScript code, and an optional hash of HTML options. The
# name is used as button label and the JavaScript code goes into its +onclick+ attribute.
# If +html_options+ has an <tt>:onclick</tt>, that one is put before +function+.
#
# button_to_function "Greeting", "alert('Hello world!')", class: "ok"
# # => <input class="ok" onclick="alert('Hello world!');" type="button" value="Greeting" />
#
def
button_to_function
(
name
,
function
=
nil
,
html_options
=
{})
message
=
"button_to_function is deprecated and will be removed from Rails 4.1. We recommend using Unobtrusive JavaScript instead. "
+
"See http://guides.rubyonrails.org/working_with_javascript_in_rails.html#unobtrusive-javascript"
ActiveSupport
::
Deprecation
.
warn
message
onclick
=
"
#{
"
#{
html_options
[
:onclick
]
}
; "
if
html_options
[
:onclick
]
}#{
function
}
;"
tag
(
:input
,
html_options
.
merge
(
:type
=>
'button'
,
:value
=>
name
,
:onclick
=>
onclick
))
end
# Returns a link whose +onclick+ handler triggers the passed JavaScript.
#
# The helper receives a name, JavaScript code, and an optional hash of HTML options. The
# name is used as the link text and the JavaScript code goes into the +onclick+ attribute.
# If +html_options+ has an <tt>:onclick</tt>, that one is put before +function+. Once all
# the JavaScript is set, the helper appends "; return false;".
#
# The +href+ attribute of the tag is set to "#" unless +html_options+ has one.
#
# link_to_function "Greeting", "alert('Hello world!')", class: "nav_link"
# # => <a class="nav_link" href="#" onclick="alert('Hello world!'); return false;">Greeting</a>
#
def
link_to_function
(
name
,
function
,
html_options
=
{})
message
=
"link_to_function is deprecated and will be removed from Rails 4.1. We recommend using Unobtrusive JavaScript instead. "
+
"See http://guides.rubyonrails.org/working_with_javascript_in_rails.html#unobtrusive-javascript"
ActiveSupport
::
Deprecation
.
warn
message
onclick
=
"
#{
"
#{
html_options
[
:onclick
]
}
; "
if
html_options
[
:onclick
]
}#{
function
}
; return false;"
href
=
html_options
[
:href
]
||
'#'
content_tag
(
:a
,
name
,
html_options
.
merge
(
:href
=>
href
,
:onclick
=>
onclick
))
end
end
end
end
actionpack/lib/action_view/helpers/url_helper.rb
浏览文件 @
6ff923a1
...
...
@@ -548,28 +548,10 @@ def convert_options_to_data_attributes(options, html_options)
html_options
=
html_options
.
stringify_keys
html_options
[
'data-remote'
]
=
'true'
if
link_to_remote_options?
(
options
)
||
link_to_remote_options?
(
html_options
)
disable_with
=
html_options
.
delete
(
"disable_with"
)
confirm
=
html_options
.
delete
(
'confirm'
)
method
=
html_options
.
delete
(
'method'
)
if
confirm
message
=
":confirm option is deprecated and will be removed from Rails 4.1. "
\
"Use 'data: { confirm:
\'
Text
\'
}' instead."
ActiveSupport
::
Deprecation
.
warn
message
html_options
[
"data-confirm"
]
=
confirm
end
add_method_to_attributes!
(
html_options
,
method
)
if
method
if
disable_with
message
=
":disable_with option is deprecated and will be removed from Rails 4.1. "
\
"Use 'data: { disable_with:
\'
Text
\'
}' instead."
ActiveSupport
::
Deprecation
.
warn
message
html_options
[
"data-disable-with"
]
=
disable_with
end
html_options
else
link_to_remote_options?
(
options
)
?
{
'data-remote'
=>
'true'
}
:
{}
...
...
actionpack/lib/action_view/template.rb
浏览文件 @
6ff923a1
...
...
@@ -146,12 +146,6 @@ def render(view, locals, buffer=nil, &block)
handle_render_error
(
view
,
e
)
end
def
mime_type
message
=
'Template#mime_type is deprecated and will be removed in Rails 4.1. Please use type method instead.'
ActiveSupport
::
Deprecation
.
warn
message
@mime_type
||=
Mime
::
Type
.
lookup_by_extension
(
@formats
.
first
.
to_s
)
if
@formats
.
first
end
def
type
@type
||=
Types
[
@formats
.
first
]
if
@formats
.
first
end
...
...
actionpack/test/controller/base_test.rb
浏览文件 @
6ff923a1
...
...
@@ -61,10 +61,7 @@ def url_options
end
end
class
RecordIdentifierController
<
ActionController
::
Base
end
class
RecordIdentifierWithoutDeprecationController
<
ActionController
::
Base
class
RecordIdentifierIncludedController
<
ActionController
::
Base
include
ActionView
::
RecordIdentifier
end
...
...
@@ -88,43 +85,20 @@ def test_controller_name
assert_equal
'contained_empty'
,
Submodule
::
ContainedEmptyController
.
controller_name
end
def
test_record_identifier
assert_respond_to
RecordIdentifierController
.
new
,
:dom_id
assert_respond_to
RecordIdentifierController
.
new
,
:dom_class
end
def
test_record_identifier_is_deprecated
record
=
Comment
.
new
record
.
save
dom_id
=
nil
assert_deprecated
'dom_id method will no longer'
do
dom_id
=
RecordIdentifierController
.
new
.
dom_id
(
record
)
end
assert_equal
'comment_1'
,
dom_id
dom_class
=
nil
assert_deprecated
'dom_class method will no longer'
do
dom_class
=
RecordIdentifierController
.
new
.
dom_class
(
record
)
end
assert_equal
'comment'
,
dom_class
end
def
test_no_deprecation_when_action_view_record_identifier_is_included
record
=
Comment
.
new
record
.
save
dom_id
=
nil
assert_not_deprecated
do
dom_id
=
RecordIdentifier
WithoutDeprecation
Controller
.
new
.
dom_id
(
record
)
dom_id
=
RecordIdentifier
Included
Controller
.
new
.
dom_id
(
record
)
end
assert_equal
'comment_1'
,
dom_id
dom_class
=
nil
assert_not_deprecated
do
dom_class
=
RecordIdentifier
WithoutDeprecation
Controller
.
new
.
dom_class
(
record
)
dom_class
=
RecordIdentifier
Included
Controller
.
new
.
dom_class
(
record
)
end
assert_equal
'comment'
,
dom_class
end
...
...
actionpack/test/controller/record_identifier_test.rb
已删除
100644 → 0
浏览文件 @
f2855f6e
require
'abstract_unit'
require
'controller/fake_models'
class
ControllerRecordIdentifierTest
<
ActiveSupport
::
TestCase
include
ActionController
::
RecordIdentifier
def
setup
@record
=
Comment
.
new
end
def
test_dom_id_deprecation
assert_deprecated
(
/dom_id method will no longer be included by default in controllers/
)
do
dom_id
(
@record
)
end
end
def
test_dom_class_deprecation
assert_deprecated
(
/dom_class method will no longer be included by default in controllers/
)
do
dom_class
(
@record
)
end
end
def
test_dom_id_from_module_deprecation
assert_deprecated
(
/Calling ActionController::RecordIdentifier.dom_id is deprecated/
)
do
ActionController
::
RecordIdentifier
.
dom_id
(
@record
)
end
end
def
test_dom_class_from_module_deprecation
assert_deprecated
(
/Calling ActionController::RecordIdentifier.dom_class is deprecated/
)
do
ActionController
::
RecordIdentifier
.
dom_class
(
@record
)
end
end
end
actionpack/test/template/form_tag_helper_test.rb
浏览文件 @
6ff923a1
...
...
@@ -410,15 +410,6 @@ def test_submit_tag_with_confirmation
)
end
def
test_submit_tag_with_deprecated_confirmation
assert_deprecated
":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm:
\'
Text
\'
}' instead"
do
assert_dom_equal
(
%(<input name='commit' type='submit' value='Save' data-confirm="Are you sure?" />)
,
submit_tag
(
"Save"
,
:confirm
=>
"Are you sure?"
)
)
end
end
def
test_button_tag
assert_dom_equal
(
%(<button name="button" type="submit">Button</button>)
,
...
...
@@ -477,15 +468,6 @@ def test_button_tag_with_confirmation
)
end
def
test_button_tag_with_deprecated_confirmation
assert_deprecated
":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm:
\'
Text
\'
}' instead"
do
assert_dom_equal
(
%(<button name="button" type="submit" data-confirm="Are you sure?">Save</button>)
,
button_tag
(
"Save"
,
:type
=>
"submit"
,
:confirm
=>
"Are you sure?"
)
)
end
end
def
test_image_submit_tag_with_confirmation
assert_dom_equal
(
%(<input alt="Save" type="image" src="/images/save.gif" data-confirm="Are you sure?" />)
,
...
...
@@ -493,16 +475,6 @@ def test_image_submit_tag_with_confirmation
)
end
def
test_image_submit_tag_with_deprecated_confirmation
assert_deprecated
":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm:
\'
Text
\'
}' instead"
do
assert_dom_equal
(
%(<input alt="Save" type="image" src="/images/save.gif" data-confirm="Are you sure?" />)
,
image_submit_tag
(
"save.gif"
,
:confirm
=>
"Are you sure?"
)
)
end
end
def
test_color_field_tag
expected
=
%{<input id="car" name="car" type="color" />}
assert_dom_equal
(
expected
,
color_field_tag
(
"car"
))
...
...
actionpack/test/template/javascript_helper_test.rb
浏览文件 @
6ff923a1
...
...
@@ -42,48 +42,6 @@ def test_escape_javascript_with_safebuffer
assert_instance_of
ActiveSupport
::
SafeBuffer
,
escape_javascript
(
ActiveSupport
::
SafeBuffer
.
new
(
given
))
end
def
test_button_to_function
assert_deprecated
do
assert_dom_equal
%(<input type="button" onclick="alert('Hello world!');" value="Greeting" />)
,
button_to_function
(
"Greeting"
,
"alert('Hello world!')"
)
end
end
def
test_button_to_function_with_onclick
assert_deprecated
do
assert_dom_equal
"<input onclick=
\"
alert('Goodbye World :('); alert('Hello world!');
\"
type=
\"
button
\"
value=
\"
Greeting
\"
/>"
,
button_to_function
(
"Greeting"
,
"alert('Hello world!')"
,
:onclick
=>
"alert('Goodbye World :(')"
)
end
end
def
test_button_to_function_without_function
assert_deprecated
do
assert_dom_equal
"<input onclick=
\"
;
\"
type=
\"
button
\"
value=
\"
Greeting
\"
/>"
,
button_to_function
(
"Greeting"
)
end
end
def
test_link_to_function
assert_deprecated
do
assert_dom_equal
%(<a href="#" onclick="alert('Hello world!'); return false;">Greeting</a>)
,
link_to_function
(
"Greeting"
,
"alert('Hello world!')"
)
end
end
def
test_link_to_function_with_existing_onclick
assert_deprecated
do
assert_dom_equal
%(<a href="#" onclick="confirm('Sanity!'); alert('Hello world!'); return false;">Greeting</a>)
,
link_to_function
(
"Greeting"
,
"alert('Hello world!')"
,
:onclick
=>
"confirm('Sanity!')"
)
end
end
def
test_function_with_href
assert_deprecated
do
assert_dom_equal
%(<a href="http://example.com/" onclick="alert('Hello world!'); return false;">Greeting</a>)
,
link_to_function
(
"Greeting"
,
"alert('Hello world!')"
,
:href
=>
'http://example.com/'
)
end
end
def
test_javascript_tag
self
.
output_buffer
=
'foo'
...
...
actionpack/test/template/template_test.rb
浏览文件 @
6ff923a1
...
...
@@ -64,13 +64,6 @@ def setup
@context
=
Context
.
new
end
def
test_mime_type_is_deprecated
template
=
new_template
assert_deprecated
'Template#mime_type is deprecated and will be removed'
do
template
.
mime_type
end
end
def
test_basic_template
@template
=
new_template
assert_equal
"Hello"
,
render
...
...
actionpack/test/template/url_helper_test.rb
浏览文件 @
6ff923a1
...
...
@@ -93,15 +93,6 @@ def test_button_to_with_javascript_confirm
)
end
def
test_button_to_with_deprecated_confirm
assert_deprecated
":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm:
\'
Text
\'
}' instead"
do
assert_dom_equal
(
%{<form method="post" action="http://www.example.com" class="button_to"><div><input data-confirm="Are you sure?" type="submit" value="Hello" /></div></form>}
,
button_to
(
"Hello"
,
"http://www.example.com"
,
confirm:
"Are you sure?"
)
)
end
end
def
test_button_to_with_javascript_disable_with
assert_dom_equal
(
%{<form method="post" action="http://www.example.com" class="button_to"><div><input data-disable-with="Greeting..." type="submit" value="Hello" /></div></form>}
,
...
...
@@ -109,15 +100,6 @@ def test_button_to_with_javascript_disable_with
)
end
def
test_button_to_with_javascript_deprecated_disable_with
assert_deprecated
":disable_with option is deprecated and will be removed from Rails 4.1. Use 'data: { disable_with:
\'
Text
\'
}' instead"
do
assert_dom_equal
(
%{<form method="post" action="http://www.example.com" class="button_to"><div><input data-disable-with="Greeting..." type="submit" value="Hello" /></div></form>}
,
button_to
(
"Hello"
,
"http://www.example.com"
,
disable_with:
"Greeting..."
)
)
end
end
def
test_button_to_with_remote_and_form_options
assert_dom_equal
(
%{<form method="post" action="http://www.example.com" class="custom-class" data-remote="true" data-type="json"><div><input type="submit" value="Hello" /></div></form>}
,
...
...
@@ -132,15 +114,6 @@ def test_button_to_with_remote_and_javascript_confirm
)
end
def
test_button_to_with_remote_and_javascript_with_deprecated_confirm
assert_deprecated
":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm:
\'
Text
\'
}' instead"
do
assert_dom_equal
(
%{<form method="post" action="http://www.example.com" class="button_to" data-remote="true"><div><input data-confirm="Are you sure?" type="submit" value="Hello" /></div></form>}
,
button_to
(
"Hello"
,
"http://www.example.com"
,
remote:
true
,
confirm:
"Are you sure?"
)
)
end
end
def
test_button_to_with_remote_and_javascript_disable_with
assert_dom_equal
(
%{<form method="post" action="http://www.example.com" class="button_to" data-remote="true"><div><input data-disable-with="Greeting..." type="submit" value="Hello" /></div></form>}
,
...
...
@@ -148,15 +121,6 @@ def test_button_to_with_remote_and_javascript_disable_with
)
end
def
test_button_to_with_remote_and_javascript_deprecated_disable_with
assert_deprecated
":disable_with option is deprecated and will be removed from Rails 4.1. Use 'data: { disable_with:
\'
Text
\'
}' instead"
do
assert_dom_equal
(
%{<form method="post" action="http://www.example.com" class="button_to" data-remote="true"><div><input data-disable-with="Greeting..." type="submit" value="Hello" /></div></form>}
,
button_to
(
"Hello"
,
"http://www.example.com"
,
remote:
true
,
disable_with:
"Greeting..."
)
)
end
end
def
test_button_to_with_remote_false
assert_dom_equal
(
%{<form method="post" action="http://www.example.com" class="button_to"><div><input type="submit" value="Hello" /></div></form>}
,
...
...
@@ -265,27 +229,6 @@ def test_link_tag_with_javascript_confirm
)
end
def
test_link_tag_with_deprecated_confirm
assert_deprecated
":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm:
\'
Text
\'
}' instead"
do
assert_dom_equal
(
%{<a href="http://www.example.com" data-confirm="Are you sure?">Hello</a>}
,
link_to
(
"Hello"
,
"http://www.example.com"
,
confirm:
"Are you sure?"
)
)
end
assert_deprecated
":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm:
\'
Text
\'
}' instead"
do
assert_dom_equal
(
%{<a href="http://www.example.com" data-confirm="You cant possibly be sure, can you?">Hello</a>}
,
link_to
(
"Hello"
,
"http://www.example.com"
,
confirm:
"You cant possibly be sure, can you?"
)
)
end
assert_deprecated
":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm:
\'
Text
\'
}' instead"
do
assert_dom_equal
(
%{<a href="http://www.example.com" data-confirm="You cant possibly be sure,\n can you?">Hello</a>}
,
link_to
(
"Hello"
,
"http://www.example.com"
,
confirm:
"You cant possibly be sure,
\n
can you?"
)
)
end
end
def
test_link_to_with_remote
assert_dom_equal
(
%{<a href="http://www.example.com" data-remote="true">Hello</a>}
,
...
...
@@ -349,15 +292,6 @@ def test_link_tag_using_post_javascript_and_confirm
)
end
def
test_link_tag_using_post_javascript_and_with_deprecated_confirm
assert_deprecated
":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm:
\'
Text
\'
}' instead"
do
assert_dom_equal
(
%{<a href="http://www.example.com" data-method="post" rel="nofollow" data-confirm="Are you serious?">Hello</a>}
,
link_to
(
"Hello"
,
"http://www.example.com"
,
method: :post
,
confirm:
"Are you serious?"
)
)
end
end
def
test_link_tag_using_delete_javascript_and_href_and_confirm
assert_dom_equal
(
%{<a href="
\#
" rel="nofollow" data-confirm="Are you serious?" data-method="delete">Destroy</a>}
,
...
...
@@ -365,15 +299,6 @@ def test_link_tag_using_delete_javascript_and_href_and_confirm
)
end
def
test_link_tag_using_delete_javascript_and_href_and_with_deprecated_confirm
assert_deprecated
":confirm option is deprecated and will be removed from Rails 4.1. Use 'data: { confirm:
\'
Text
\'
}' instead"
do
assert_dom_equal
(
%{<a href="
\#
" rel="nofollow" data-confirm="Are you serious?" data-method="delete">Destroy</a>}
,
link_to
(
"Destroy"
,
"http://www.example.com"
,
method: :delete
,
href:
'#'
,
confirm:
"Are you serious?"
)
)
end
end
def
test_link_tag_with_block
assert_dom_equal
%{<a href="/"><span>Example site</span></a>}
,
link_to
(
'/'
)
{
content_tag
(
:span
,
'Example site'
)
}
...
...
activerecord/lib/active_record/relation/calculations.rb
浏览文件 @
6ff923a1
...
...
@@ -56,15 +56,7 @@ def maximum(column_name, options = {})
#
# Person.sum(:age) # => 4562
def
sum
(
*
args
)
if
block_given?
ActiveSupport
::
Deprecation
.
warn
(
"Calling #sum with a block is deprecated and will be removed in Rails 4.1. "
\
"If you want to perform sum calculation over the array of elements, use `to_a.sum(&block)`."
)
self
.
to_a
.
sum
(
*
args
)
{
|*
block_args
|
yield
(
*
block_args
)}
else
calculate
(
:sum
,
*
args
)
end
calculate
(
:sum
,
*
args
)
end
# This calculates aggregate values in the given column. Methods for count, sum, average,
...
...
activerecord/test/cases/associations/has_many_associations_test.rb
浏览文件 @
6ff923a1
...
...
@@ -1747,12 +1747,6 @@ def test_collection_association_with_private_kernel_method
assert_deprecated
{
klass
.
has_many
:foo
,
:counter_sql
=>
'lol'
}
end
test
"sum calculation with block for array compatibility is deprecated"
do
assert_deprecated
do
posts
(
:welcome
).
comments
.
sum
{
|
c
|
c
.
id
}
end
end
test
"has many associations on new records use null relations"
do
post
=
Post
.
new
...
...
activerecord/test/cases/base_test.rb
浏览文件 @
6ff923a1
...
...
@@ -1228,38 +1228,6 @@ def test_assert_queries
assert_no_queries
{
assert
true
}
end
def
test_silence_sets_log_level_to_error_in_block
original_logger
=
ActiveRecord
::
Base
.
logger
assert_deprecated
do
log
=
StringIO
.
new
ActiveRecord
::
Base
.
logger
=
ActiveSupport
::
Logger
.
new
(
log
)
ActiveRecord
::
Base
.
logger
.
level
=
Logger
::
DEBUG
ActiveRecord
::
Base
.
silence
do
ActiveRecord
::
Base
.
logger
.
warn
"warn"
ActiveRecord
::
Base
.
logger
.
error
"error"
end
assert_equal
"error
\n
"
,
log
.
string
end
ensure
ActiveRecord
::
Base
.
logger
=
original_logger
end
def
test_silence_sets_log_level_back_to_level_before_yield
original_logger
=
ActiveRecord
::
Base
.
logger
assert_deprecated
do
log
=
StringIO
.
new
ActiveRecord
::
Base
.
logger
=
ActiveSupport
::
Logger
.
new
(
log
)
ActiveRecord
::
Base
.
logger
.
level
=
Logger
::
WARN
ActiveRecord
::
Base
.
silence
do
end
assert_equal
Logger
::
WARN
,
ActiveRecord
::
Base
.
logger
.
level
end
ensure
ActiveRecord
::
Base
.
logger
=
original_logger
end
def
test_benchmark_with_log_level
original_logger
=
ActiveRecord
::
Base
.
logger
log
=
StringIO
.
new
...
...
activerecord/test/cases/calculations_test.rb
浏览文件 @
6ff923a1
...
...
@@ -410,12 +410,6 @@ def test_sum_with_from_option
Account
.
where
(
"credit_limit > 50"
).
from
(
'accounts'
).
sum
(
:credit_limit
)
end
def
test_sum_array_compatibility_deprecation
assert_deprecated
do
assert_equal
Account
.
sum
(
:credit_limit
),
Account
.
sum
(
&
:credit_limit
)
end
end
def
test_average_with_from_option
assert_equal
Account
.
average
(
:credit_limit
),
Account
.
from
(
'accounts'
).
average
(
:credit_limit
)
assert_equal
Account
.
where
(
"credit_limit > 50"
).
average
(
:credit_limit
),
...
...
activesupport/lib/active_support/benchmarkable.rb
浏览文件 @
6ff923a1
...
...
@@ -45,15 +45,5 @@ def benchmark(message = "Benchmarking", options = {})
yield
end
end
# Silence the logger during the execution of the block.
def
silence
message
=
"ActiveSupport::Benchmarkable#silence is deprecated. It will be removed from Rails 4.1."
ActiveSupport
::
Deprecation
.
warn
message
old_logger_level
,
logger
.
level
=
logger
.
level
,
::
Logger
::
ERROR
if
logger
yield
ensure
logger
.
level
=
old_logger_level
if
logger
end
end
end
activesupport/lib/active_support/json/encoding.rb
浏览文件 @
6ff923a1
...
...
@@ -2,7 +2,6 @@
require
'active_support/core_ext/object/to_json'
require
'active_support/core_ext/module/delegation'
require
'active_support/json/variable'
require
'bigdecimal'
require
'active_support/core_ext/big_decimal/conversions'
# for #to_s
...
...
activesupport/lib/active_support/json/variable.rb
已删除
100644 → 0
浏览文件 @
f2855f6e
require
'active_support/deprecation'
module
ActiveSupport
module
JSON
# Deprecated: A string that returns itself as its JSON-encoded form.
class
Variable
<
String
def
initialize
(
*
args
)
message
=
'ActiveSupport::JSON::Variable is deprecated and will be removed in Rails 4.1. '
\
'For your own custom JSON literals, define #as_json and #encode_json yourself.'
ActiveSupport
::
Deprecation
.
warn
message
super
end
def
as_json
(
options
=
nil
)
self
end
#:nodoc:
def
encode_json
(
encoder
)
self
end
#:nodoc:
end
end
end
activesupport/lib/active_support/test_case.rb
浏览文件 @
6ff923a1
...
...
@@ -4,7 +4,6 @@
require
'active_support/testing/setup_and_teardown'
require
'active_support/testing/assertions'
require
'active_support/testing/deprecation'
require
'active_support/testing/pending'
require
'active_support/testing/declarative'
require
'active_support/testing/isolation'
require
'active_support/testing/constant_lookup'
...
...
@@ -54,7 +53,6 @@ def self.test_order # :nodoc:
include
ActiveSupport
::
Testing
::
SetupAndTeardown
include
ActiveSupport
::
Testing
::
Assertions
include
ActiveSupport
::
Testing
::
Deprecation
include
ActiveSupport
::
Testing
::
Pending
extend
ActiveSupport
::
Testing
::
Declarative
# test/unit backwards compatibility methods
...
...
activesupport/lib/active_support/testing/pending.rb
已删除
100644 → 0
浏览文件 @
f2855f6e
require
'active_support/deprecation'
module
ActiveSupport
module
Testing
module
Pending
# :nodoc:
unless
defined?
(
Spec
)
def
pending
(
description
=
""
,
&
block
)
ActiveSupport
::
Deprecation
.
warn
(
"#pending is deprecated and will be removed in Rails 4.1, please use #skip instead."
)
skip
(
description
.
blank?
?
nil
:
description
)
end
end
end
end
end
activesupport/test/json/encoding_test.rb
浏览文件 @
6ff923a1
...
...
@@ -96,13 +96,6 @@ def sorted_json(json)
end
end
def
test_json_variable
assert_deprecated
do
assert_equal
ActiveSupport
::
JSON
::
Variable
.
new
(
'foo'
),
'foo'
assert_equal
ActiveSupport
::
JSON
::
Variable
.
new
(
'alert("foo")'
),
'alert("foo")'
end
end
def
test_hash_encoding
assert_equal
%({\"a\":\"b\"})
,
ActiveSupport
::
JSON
.
encode
(
:a
=>
:b
)
assert_equal
%({\"a\":1})
,
ActiveSupport
::
JSON
.
encode
(
'a'
=>
1
)
...
...
activesupport/test/test_case_test.rb
已删除
100644 → 0
浏览文件 @
f2855f6e
require
'abstract_unit'
module
ActiveSupport
class
TestCaseTest
<
ActiveSupport
::
TestCase
def
test_pending_deprecation
assert_deprecated
do
pending
"should use #skip instead"
end
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录