Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
e51ecfaa
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,发现更多精彩内容 >>
提交
e51ecfaa
编写于
11月 29, 2011
作者:
J
Jon Leighton
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
extract method
上级
7af719e8
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
49 deletion
+25
-49
activerecord/lib/active_record/base.rb
activerecord/lib/active_record/base.rb
+25
-49
未找到文件。
activerecord/lib/active_record/base.rb
浏览文件 @
e51ecfaa
...
...
@@ -586,6 +586,24 @@ def serialize(attr_name, class_name = Object)
self
.
serialized_attributes
=
serialized_attributes
.
merge
(
attr_name
.
to_s
=>
coder
)
end
def
deprecated_property_setter
(
property
,
value
,
block
)
#:nodoc:
if
block
ActiveSupport
::
Deprecation
.
warn
(
"Calling set_
#{
property
}
is deprecated. If you need to lazily evaluate "
\
"the
#{
property
}
, define your own `self.
#{
property
}
` class method. You can use `super` "
\
"to get the default
#{
property
}
where you would have called `original_
#{
property
}
`."
)
define_attr_method
property
,
value
,
&
block
else
ActiveSupport
::
Deprecation
.
warn
(
"Calling set_
#{
property
}
is deprecated. Please use `self.
#{
property
}
= 'the_name'` instead."
)
define_attr_method
property
,
value
end
end
# Guesses the table name (in forced lower-case) based on the name of the class in the
# inheritance hierarchy descending directly from ActiveRecord::Base. So if the hierarchy
# looks like: Reply < Message < ActiveRecord::Base, then Message is used
...
...
@@ -655,31 +673,17 @@ def table_name
# You can also just define your own <tt>self.table_name</tt> method; see
# the documentation for ActiveRecord::Base#table_name.
def
table_name
=
(
value
)
@table_name
=
value
@quoted_table_name
=
nil
@arel_table
=
nil
@table_name
=
value
@relation
=
Relation
.
new
(
self
,
arel_table
)
end
def
set_table_name
(
value
=
nil
,
&
block
)
#:nodoc:
if
block
ActiveSupport
::
Deprecation
.
warn
(
"Calling set_table_name is deprecated. If you need to lazily evaluate "
\
"the table name, define your own `self.table_name` class method. You can use `super` "
\
"to get the default table name where you would have called `original_table_name`."
)
@quoted_table_name
=
nil
define_attr_method
:table_name
,
value
,
&
block
@arel_table
=
nil
@relation
=
Relation
.
new
(
self
,
arel_table
)
else
ActiveSupport
::
Deprecation
.
warn
(
"Calling set_table_name is deprecated. Please use `self.table_name = 'the_name'` instead."
)
self
.
table_name
=
value
end
deprecated_property_setter
:table_name
,
value
,
block
@quoted_table_name
=
nil
@arel_table
=
nil
@relation
=
Relation
.
new
(
self
,
arel_table
)
end
# Returns a quoted version of the table name, used to construct SQL statements.
...
...
@@ -717,21 +721,7 @@ def inheritance_column=(value)
end
def
set_inheritance_column
(
value
=
nil
,
&
block
)
#:nodoc:
if
block
ActiveSupport
::
Deprecation
.
warn
(
"Calling set_inheritance_column is deprecated. If you need to lazily evaluate "
\
"the inheritance column, define your own `self.inheritance_column` class method. You can use `super` "
\
"to get the default inheritance column where you would have called `original_inheritance_column`."
)
define_attr_method
:inheritance_column
,
value
,
&
block
else
ActiveSupport
::
Deprecation
.
warn
(
"Calling set_inheritance_column is deprecated. Please use `self.inheritance_column = 'the_name'` instead."
)
self
.
inheritance_column
=
value
end
deprecated_property_setter
:inheritance_column
,
value
,
block
end
def
sequence_name
...
...
@@ -765,21 +755,7 @@ def sequence_name=(value)
end
def
set_sequence_name
(
value
=
nil
,
&
block
)
#:nodoc:
if
block
ActiveSupport
::
Deprecation
.
warn
(
"Calling set_sequence_name is deprecated. If you need to lazily evaluate "
\
"the sequence name, define your own `self.sequence_name` class method. You can use `super` "
\
"to get the default sequence name where you would have called `original_sequence_name`."
)
define_attr_method
:sequence_name
,
value
,
&
block
else
ActiveSupport
::
Deprecation
.
warn
(
"Calling set_sequence_name is deprecated. Please use `self.sequence_name = 'the_name'` instead."
)
self
.
sequence_name
=
value
end
deprecated_property_setter
:sequence_name
,
value
,
block
end
# Indicates whether the table associated with this class exists
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录