Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
c4245c31
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 搜索 >>
提交
c4245c31
编写于
5月 19, 2014
作者:
S
Sean Griffin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Delegate `klass` to the injected type object
上级
470c4dfe
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
33 addition
and
14 deletion
+33
-14
activerecord/lib/active_record/connection_adapters/column.rb
activerecord/lib/active_record/connection_adapters/column.rb
+1
-14
activerecord/lib/active_record/connection_adapters/type/binary.rb
...cord/lib/active_record/connection_adapters/type/binary.rb
+4
-0
activerecord/lib/active_record/connection_adapters/type/date.rb
...record/lib/active_record/connection_adapters/type/date.rb
+4
-0
activerecord/lib/active_record/connection_adapters/type/decimal.rb
...ord/lib/active_record/connection_adapters/type/decimal.rb
+4
-0
activerecord/lib/active_record/connection_adapters/type/float.rb
...ecord/lib/active_record/connection_adapters/type/float.rb
+4
-0
activerecord/lib/active_record/connection_adapters/type/integer.rb
...ord/lib/active_record/connection_adapters/type/integer.rb
+4
-0
activerecord/lib/active_record/connection_adapters/type/string.rb
...cord/lib/active_record/connection_adapters/type/string.rb
+4
-0
activerecord/lib/active_record/connection_adapters/type/time_value.rb
.../lib/active_record/connection_adapters/type/time_value.rb
+4
-0
activerecord/lib/active_record/connection_adapters/type/value.rb
...ecord/lib/active_record/connection_adapters/type/value.rb
+4
-0
未找到文件。
activerecord/lib/active_record/connection_adapters/column.rb
浏览文件 @
c4245c31
...
...
@@ -18,7 +18,7 @@ module Format
alias
:encoded?
:coder
delegate
:type
,
:text?
,
:number?
,
:binary?
,
:type_cast_for_write
,
to: :cast_type
delegate
:type
,
:
klass
,
:
text?
,
:number?
,
:binary?
,
:type_cast_for_write
,
to: :cast_type
# Instantiates a new column in the table.
#
...
...
@@ -47,19 +47,6 @@ def has_default?
!
default
.
nil?
end
# Returns the Ruby class that corresponds to the abstract data type.
def
klass
case
type
when
:integer
then
Fixnum
when
:float
then
Float
when
:decimal
then
BigDecimal
when
:datetime
,
:time
then
Time
when
:date
then
Date
when
:text
,
:string
,
:binary
then
String
when
:boolean
then
Object
end
end
# Casts value to an appropriate instance.
def
type_cast
(
value
)
if
encoded?
...
...
activerecord/lib/active_record/connection_adapters/type/binary.rb
浏览文件 @
c4245c31
...
...
@@ -9,6 +9,10 @@ def type
def
binary?
true
end
def
klass
::
String
end
end
end
end
...
...
activerecord/lib/active_record/connection_adapters/type/date.rb
浏览文件 @
c4245c31
...
...
@@ -6,6 +6,10 @@ def type
:date
end
def
klass
::
Date
end
private
def
cast_value
(
value
)
...
...
activerecord/lib/active_record/connection_adapters/type/decimal.rb
浏览文件 @
c4245c31
...
...
@@ -8,6 +8,10 @@ def type
:decimal
end
def
klass
::
BigDecimal
end
private
def
cast_value
(
value
)
...
...
activerecord/lib/active_record/connection_adapters/type/float.rb
浏览文件 @
c4245c31
...
...
@@ -8,6 +8,10 @@ def type
:float
end
def
klass
::
Float
end
private
def
cast_value
(
value
)
...
...
activerecord/lib/active_record/connection_adapters/type/integer.rb
浏览文件 @
c4245c31
...
...
@@ -8,6 +8,10 @@ def type
:integer
end
def
klass
::
Fixnum
end
private
def
cast_value
(
value
)
...
...
activerecord/lib/active_record/connection_adapters/type/string.rb
浏览文件 @
c4245c31
...
...
@@ -10,6 +10,10 @@ def text?
true
end
def
klass
::
String
end
private
def
cast_value
(
value
)
...
...
activerecord/lib/active_record/connection_adapters/type/time_value.rb
浏览文件 @
c4245c31
...
...
@@ -2,6 +2,10 @@ module ActiveRecord
module
ConnectionAdapters
module
Type
module
TimeValue
# :nodoc:
def
klass
::
Time
end
private
def
new_time
(
year
,
mon
,
mday
,
hour
,
min
,
sec
,
microsec
,
offset
=
nil
)
...
...
activerecord/lib/active_record/connection_adapters/type/value.rb
浏览文件 @
c4245c31
...
...
@@ -24,6 +24,10 @@ def binary?
false
end
def
klass
::
Object
end
private
def
cast_value
(
value
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录