Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
1c85eece
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,发现更多精彩内容 >>
提交
1c85eece
编写于
7月 20, 2017
作者:
D
David Heinemeier Hansson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move controllers to default engine location for auto loading
上级
1a9026b4
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
23 addition
and
14 deletion
+23
-14
Rakefile
Rakefile
+1
-0
app/controllers/active_storage/disk_controller.rb
app/controllers/active_storage/disk_controller.rb
+0
-0
app/controllers/active_storage/variants_controller.rb
app/controllers/active_storage/variants_controller.rb
+22
-0
lib/active_storage/direct_uploads_controller.rb
lib/active_storage/direct_uploads_controller.rb
+0
-14
未找到文件。
Rakefile
浏览文件 @
1c85eece
...
...
@@ -3,6 +3,7 @@ require "bundler/gem_tasks"
require
"rake/testtask"
Rake
::
TestTask
.
new
do
|
test
|
test
.
libs
<<
"app/controllers"
test
.
libs
<<
"test"
test
.
test_files
=
FileList
[
"test/**/*_test.rb"
]
test
.
warning
=
false
...
...
lib
/active_storage/disk_controller.rb
→
app/controllers
/active_storage/disk_controller.rb
浏览文件 @
1c85eece
文件已移动
app/controllers/active_storage/variants_controller.rb
0 → 100644
浏览文件 @
1c85eece
class
ActiveStorage::VariantsController
<
ActionController
::
Base
def
show
if
blob_key
=
decode_verified_blob_key
redirect_to
processed_variant_for
(
blob_key
).
url
(
disposition:
disposition_param
)
else
head
:not_found
end
end
private
def
decode_verified_blob_key
ActiveStorage
::
VerifiedKeyWithExpiration
.
decode
(
params
[
:encoded_blob_key
])
end
def
processed_variant_for
(
blob_key
)
ActiveStorage
::
Variant
.
find_or_process_by!
(
blob_key:
blob_key
,
encoded_variant_key:
params
[
:encoded_variant_key
])
end
def
disposition_param
params
[
:disposition
].
presence_in
(
%w( inline attachment )
)
||
'inline'
end
end
lib/active_storage/direct_uploads_controller.rb
已删除
100644 → 0
浏览文件 @
1a9026b4
require
"action_controller"
require
"active_storage/blob"
class
ActiveStorage::DirectUploadsController
<
ActionController
::
Base
def
create
blob
=
ActiveStorage
::
Blob
.
create_before_direct_upload!
(
blob_args
)
render
json:
{
url:
blob
.
url_for_direct_upload
,
sgid:
blob
.
to_sgid
.
to_param
}
end
private
def
blob_args
params
.
require
(
:blob
).
permit
(
:filename
,
:byte_size
,
:checksum
,
:content_type
,
:metadata
).
to_h
.
symbolize_keys
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录