Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
17769696
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,发现更多精彩内容 >>
提交
17769696
编写于
3月 04, 2010
作者:
C
Carlhuda
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move session and session_store onto ActionDispatch and add deprecation warnings
上级
c0c1599f
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
43 addition
and
24 deletion
+43
-24
actionpack/lib/action_controller/metal/compatibility.rb
actionpack/lib/action_controller/metal/compatibility.rb
+6
-0
actionpack/lib/action_controller/metal/session_management.rb
actionpack/lib/action_controller/metal/session_management.rb
+0
-5
actionpack/lib/action_controller/railtie.rb
actionpack/lib/action_controller/railtie.rb
+33
-17
actionpack/lib/action_dispatch/railtie.rb
actionpack/lib/action_dispatch/railtie.rb
+2
-0
railties/lib/rails/railtie/configuration.rb
railties/lib/rails/railtie/configuration.rb
+2
-2
未找到文件。
actionpack/lib/action_controller/metal/compatibility.rb
浏览文件 @
17769696
...
...
@@ -158,6 +158,12 @@ def trusted_proxies
Rails
.
application
.
config
.
action_dispatch
.
ip_spoofing_check
=
value
end
def
session
=
(
value
)
ActiveSupport
::
Deprecation
.
warn
"ActionController::Base.session= is deprecated. "
<<
"Please configure it on your application with config.action_dispatch.session="
,
caller
Rails
.
application
.
config
.
action_dispatch
.
session
=
value
.
delete
(
:disabled
)
?
nil
:
value
end
def
rescue_action
(
env
)
raise
env
[
"action_dispatch.rescue.exception"
]
end
...
...
actionpack/lib/action_controller/metal/session_management.rb
浏览文件 @
17769696
...
...
@@ -27,11 +27,6 @@ def session_store
SessionManagement
.
session_store_for
(
config
.
session_store
)
end
def
session
=
(
options
=
{})
self
.
session_store
=
nil
if
options
.
delete
(
:disabled
)
session_options
.
merge!
(
options
)
end
def
session
(
*
args
)
ActiveSupport
::
Deprecation
.
warn
(
"Disabling sessions for a single controller has been deprecated. "
+
...
...
actionpack/lib/action_controller/railtie.rb
浏览文件 @
17769696
...
...
@@ -3,6 +3,7 @@
require
"action_view/railtie"
require
"active_support/core_ext/class/subclasses"
require
"active_support/deprecation/proxy_wrappers"
require
"active_support/deprecation"
module
ActionController
class
Railtie
<
Rails
::
Railtie
...
...
@@ -11,33 +12,48 @@ class Railtie < Rails::Railtie
require
"action_controller/railties/log_subscriber"
require
"action_controller/railties/url_helpers"
log_subscriber
ActionController
::
Railties
::
LogSubscriber
.
new
ad
=
config
.
action_dispatch
config
.
action_controller
.
singleton_class
.
send
(
:define_method
,
:session
)
do
ActiveSupport
::
Deprecation
.
warn
"config.action_controller.session has been "
\
"renamed to config.action_dispatch.session."
,
caller
ad
.
session
end
config
.
action_controller
.
session_store
=
:cookie_store
config
.
action_controller
.
session_options
=
{}
config
.
action_controller
.
singleton_class
.
send
(
:define_method
,
:session
=
)
do
|
val
|
ActiveSupport
::
Deprecation
.
warn
"config.action_controller.session has been "
\
"renamed to config.action_dispatch.session."
,
caller
ad
.
session
=
val
end
initializer
"action_controller.logger"
do
ActionController
::
Base
.
logger
||=
Rails
.
logger
config
.
action_controller
.
singleton_class
.
send
(
:define_method
,
:session_store
)
do
ActiveSupport
::
Deprecation
.
warn
"config.action_controller.session_store has been "
\
"renamed to config.action_dispatch.session_store."
,
caller
ad
.
session_store
end
# assets_dir = defined?(Rails.public_path) ? Rails.public_path : "public"
# ActionView::DEFAULT_CONFIG = {
# :assets_dir => assets_dir,
# :javascripts_dir => "#{assets_dir}/javascripts",
# :stylesheets_dir => "#{assets_dir}/stylesheets",
# }
config
.
action_controller
.
singleton_class
.
send
(
:define_method
,
:session_store
=
)
do
|
val
|
ActiveSupport
::
Deprecation
.
warn
"config.action_controller.session_store has been "
\
"renamed to config.action_dispatch.session_store."
,
caller
ad
.
session_store
=
val
end
log_subscriber
ActionController
::
Railties
::
LogSubscriber
.
new
initializer
"action_controller.logger"
do
ActionController
::
Base
.
logger
||=
Rails
.
logger
end
initializer
"action_controller.set_configs"
do
|
app
|
paths
=
app
.
config
.
paths
ac
=
app
.
config
.
action_controller
ac
.
assets_dir
=
paths
.
public
ac
.
javascripts_dir
=
paths
.
public
.
javascripts
ac
.
stylesheets_dir
=
paths
.
public
.
stylesheets
ac
.
assets_dir
=
paths
.
public
.
to_a
.
first
ac
.
javascripts_dir
=
paths
.
public
.
javascripts
.
to_a
.
first
ac
.
stylesheets_dir
=
paths
.
public
.
stylesheets
.
to_a
.
first
app
.
config
.
action_controller
.
each
do
|
k
,
v
|
ActionController
::
Base
.
send
"
#{
k
}
="
,
v
end
ActionController
::
Base
.
config
.
replace
(
ac
)
# app.config.action_controller.each do |k,v|
# ActionController::Base.send "#{k}=", v
# end
end
initializer
"action_controller.initialize_framework_caches"
do
...
...
actionpack/lib/action_dispatch/railtie.rb
浏览文件 @
17769696
...
...
@@ -7,6 +7,8 @@ class Railtie < Rails::Railtie
config
.
action_dispatch
.
x_sendfile_header
=
"X-Sendfile"
config
.
action_dispatch
.
ip_spoofing_check
=
true
config
.
action_dispatch
.
session
=
{}
config
.
action_dispatch
.
session_store
=
:cookie_store
# Prepare dispatcher callbacks and run 'prepare' callbacks
initializer
"action_dispatch.prepare_dispatcher"
do
|
app
|
...
...
railties/lib/rails/railtie/configuration.rb
浏览文件 @
17769696
...
...
@@ -86,8 +86,8 @@ def default_middleware
middleware
.
use
(
'::Rack::Sendfile'
,
lambda
{
action_dispatch
.
x_sendfile_header
})
middleware
.
use
(
'::ActionDispatch::Callbacks'
,
lambda
{
!
cache_classes
})
middleware
.
use
(
'::ActionDispatch::Cookies'
)
middleware
.
use
(
lambda
{
ActionController
::
SessionManagement
.
session_store_for
(
action_
controller
.
session_store
)
},
lambda
{
action_controller
.
session
})
middleware
.
use
(
'::ActionDispatch::Flash'
,
:if
=>
lambda
{
action_
controller
.
session_store
})
middleware
.
use
(
lambda
{
ActionController
::
SessionManagement
.
session_store_for
(
action_
dispatch
.
session_store
)
},
lambda
{
action_dispatch
.
session
})
middleware
.
use
(
'::ActionDispatch::Flash'
,
:if
=>
lambda
{
action_
dispatch
.
session_store
})
middleware
.
use
(
lambda
{
metal_loader
.
build_middleware
(
metals
)
},
:if
=>
lambda
{
metal_loader
.
metals
.
any?
})
middleware
.
use
(
'ActionDispatch::ParamsParser'
)
middleware
.
use
(
'::Rack::MethodOverride'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录