Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
b45c9ca9
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 搜索 >>
提交
b45c9ca9
编写于
8月 07, 2016
作者:
X
Xavier Noria
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
revises most Lint/EndAlignment offenses
Some case expressions remain, need to think about those ones.
上级
f90ee8ce
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
58 addition
and
55 deletion
+58
-55
activemodel/lib/active_model/validations/clusivity.rb
activemodel/lib/active_model/validations/clusivity.rb
+5
-5
activerecord/lib/active_record/associations/collection_association.rb
.../lib/active_record/associations/collection_association.rb
+5
-5
activerecord/lib/active_record/attribute_methods.rb
activerecord/lib/active_record/attribute_methods.rb
+3
-3
activerecord/lib/active_record/attribute_methods/serialization.rb
...cord/lib/active_record/attribute_methods/serialization.rb
+5
-5
activerecord/lib/active_record/core.rb
activerecord/lib/active_record/core.rb
+6
-5
activerecord/lib/active_record/railties/databases.rake
activerecord/lib/active_record/railties/databases.rake
+7
-7
activerecord/lib/active_record/relation/finder_methods.rb
activerecord/lib/active_record/relation/finder_methods.rb
+7
-7
activerecord/lib/active_record/tasks/database_tasks.rb
activerecord/lib/active_record/tasks/database_tasks.rb
+3
-3
activerecord/test/cases/column_alias_test.rb
activerecord/test/cases/column_alias_test.rb
+3
-3
activerecord/test/cases/migration/columns_test.rb
activerecord/test/cases/migration/columns_test.rb
+4
-3
railties/lib/rails/commands/plugin.rb
railties/lib/rails/commands/plugin.rb
+4
-3
railties/lib/rails/info.rb
railties/lib/rails/info.rb
+3
-3
railties/lib/rails/test_unit/testing.rake
railties/lib/rails/test_unit/testing.rake
+3
-3
未找到文件。
activemodel/lib/active_model/validations/clusivity.rb
浏览文件 @
b45c9ca9
...
...
@@ -17,11 +17,11 @@ def check_validity!
def
include?
(
record
,
value
)
members
=
if
delimiter
.
respond_to?
(
:call
)
delimiter
.
call
(
record
)
elsif
delimiter
.
respond_to?
(
:to_sym
)
record
.
send
(
delimiter
)
else
delimiter
end
elsif
delimiter
.
respond_to?
(
:to_sym
)
record
.
send
(
delimiter
)
else
delimiter
end
members
.
send
(
inclusion_method
(
members
),
value
)
end
...
...
activerecord/lib/active_record/associations/collection_association.rb
浏览文件 @
b45c9ca9
...
...
@@ -221,11 +221,11 @@ def delete_all(dependent = nil)
dependent
=
if
dependent
dependent
elsif
options
[
:dependent
]
==
:destroy
:delete_all
else
options
[
:dependent
]
end
elsif
options
[
:dependent
]
==
:destroy
:delete_all
else
options
[
:dependent
]
end
delete_or_nullify_all_records
(
dependent
).
tap
do
reset
...
...
activerecord/lib/active_record/attribute_methods.rb
浏览文件 @
b45c9ca9
...
...
@@ -162,9 +162,9 @@ def attribute_method?(attribute)
def
attribute_names
@attribute_names
||=
if
!
abstract_class?
&&
table_exists?
attribute_types
.
keys
else
[]
end
else
[]
end
end
# Returns true if the given attribute exists, otherwise false.
...
...
activerecord/lib/active_record/attribute_methods/serialization.rb
浏览文件 @
b45c9ca9
...
...
@@ -51,11 +51,11 @@ def serialize(attr_name, class_name_or_coder = Object)
# using the #as_json hook.
coder
=
if
class_name_or_coder
==
::
JSON
Coders
::
JSON
elsif
[
:load
,
:dump
].
all?
{
|
x
|
class_name_or_coder
.
respond_to?
(
x
)
}
class_name_or_coder
else
Coders
::
YAMLColumn
.
new
(
class_name_or_coder
)
end
elsif
[
:load
,
:dump
].
all?
{
|
x
|
class_name_or_coder
.
respond_to?
(
x
)
}
class_name_or_coder
else
Coders
::
YAMLColumn
.
new
(
class_name_or_coder
)
end
decorate_attribute_type
(
attr_name
,
:serialize
)
do
|
type
|
Type
::
Serialized
.
new
(
type
,
coder
)
...
...
activerecord/lib/active_record/core.rb
浏览文件 @
b45c9ca9
...
...
@@ -498,14 +498,15 @@ def inspect
# We check defined?(@attributes) not to issue warnings if the object is
# allocated but not initialized.
inspection
=
if
defined?
(
@attributes
)
&&
@attributes
self
.
class
.
column_names
.
collect
{
|
name
|
self
.
class
.
column_names
.
collect
do
|
name
|
if
has_attribute?
(
name
)
"
#{
name
}
:
#{
attribute_for_inspect
(
name
)
}
"
end
}.
compact
.
join
(
", "
)
else
"not initialized"
end
end
.
compact
.
join
(
", "
)
else
"not initialized"
end
"#<
#{
self
.
class
}
#{
inspection
}
>"
end
...
...
activerecord/lib/active_record/railties/databases.rake
浏览文件 @
b45c9ca9
...
...
@@ -205,16 +205,16 @@ db_namespace = namespace :db do
fixtures_dir
=
if
ENV
[
"FIXTURES_DIR"
]
File
.
join
base_dir
,
ENV
[
"FIXTURES_DIR"
]
else
base_dir
end
else
base_dir
end
fixture_files
=
if
ENV
[
"FIXTURES"
]
ENV
[
"FIXTURES"
].
split
(
","
)
else
# The use of String#[] here is to support namespaced fixtures
Dir
[
"
#{
fixtures_dir
}
/**/*.yml"
].
map
{
|
f
|
f
[(
fixtures_dir
.
size
+
1
)
..-
5
]
}
end
else
# The use of String#[] here is to support namespaced fixtures.
Dir
[
"
#{
fixtures_dir
}
/**/*.yml"
].
map
{
|
f
|
f
[(
fixtures_dir
.
size
+
1
)
..-
5
]
}
end
ActiveRecord
::
FixtureSet
.
create_fixtures
(
fixtures_dir
,
fixture_files
)
end
...
...
activerecord/lib/active_record/relation/finder_methods.rb
浏览文件 @
b45c9ca9
...
...
@@ -544,12 +544,12 @@ def find_nth!(index)
def
find_nth_with_limit
(
index
,
limit
)
# TODO: once the offset argument is removed from find_nth,
# find_nth_with_limit_and_offset can be merged into this method
# find_nth_with_limit_and_offset can be merged into this method
.
relation
=
if
order_values
.
empty?
&&
primary_key
order
(
arel_attribute
(
primary_key
).
asc
)
else
self
end
else
self
end
relation
=
relation
.
offset
(
index
)
unless
index
.
zero?
relation
.
limit
(
limit
).
to_a
...
...
@@ -561,9 +561,9 @@ def find_nth_from_last(index)
else
relation
=
if
order_values
.
empty?
&&
primary_key
order
(
arel_attribute
(
primary_key
).
asc
)
else
self
end
else
self
end
relation
.
to_a
[
-
index
]
# TODO: can be made more performant on large result sets by
...
...
activerecord/lib/active_record/tasks/database_tasks.rb
浏览文件 @
b45c9ca9
...
...
@@ -78,9 +78,9 @@ def migrations_paths
def
fixtures_path
@fixtures_path
||=
if
ENV
[
"FIXTURES_PATH"
]
File
.
join
(
root
,
ENV
[
"FIXTURES_PATH"
])
else
File
.
join
(
root
,
"test"
,
"fixtures"
)
end
else
File
.
join
(
root
,
"test"
,
"fixtures"
)
end
end
def
root
...
...
activerecord/test/cases/column_alias_test.rb
浏览文件 @
b45c9ca9
...
...
@@ -6,9 +6,9 @@ class TestColumnAlias < ActiveRecord::TestCase
QUERY
=
if
"Oracle"
==
ActiveRecord
::
Base
.
connection
.
adapter_name
"SELECT id AS pk FROM topics WHERE ROWNUM < 2"
else
"SELECT id AS pk FROM topics"
end
else
"SELECT id AS pk FROM topics"
end
def
test_column_alias
records
=
Topic
.
connection
.
select_all
(
QUERY
)
...
...
activerecord/test/cases/migration/columns_test.rb
浏览文件 @
b45c9ca9
...
...
@@ -75,9 +75,10 @@ def test_mysql_rename_column_preserves_auto_increment
def
test_rename_nonexistent_column
exception
=
if
current_adapter?
(
:PostgreSQLAdapter
,
:OracleAdapter
)
ActiveRecord
::
StatementInvalid
else
ActiveRecord
::
ActiveRecordError
end
else
ActiveRecord
::
ActiveRecordError
end
assert_raise
(
exception
)
do
rename_column
"test_models"
,
"nonexistent"
,
"should_fail"
end
...
...
railties/lib/rails/commands/plugin.rb
浏览文件 @
b45c9ca9
...
...
@@ -6,9 +6,10 @@
customrc
=
ARGV
.
index
{
|
x
|
x
.
include?
(
"--rc="
)
}
railsrc
=
if
customrc
File
.
expand_path
(
ARGV
.
delete_at
(
customrc
).
gsub
(
/--rc=/
,
""
))
else
File
.
join
(
File
.
expand_path
(
"~"
),
".railsrc"
)
end
else
File
.
join
(
File
.
expand_path
(
"~"
),
".railsrc"
)
end
if
File
.
exist?
(
railsrc
)
extra_args_string
=
File
.
read
(
railsrc
)
extra_args
=
extra_args_string
.
split
(
/\n+/
).
flat_map
(
&
:split
)
...
...
railties/lib/rails/info.rb
浏览文件 @
b45c9ca9
...
...
@@ -43,9 +43,9 @@ def to_html
table
<<
%(<tr><td class="name">#{CGI.escapeHTML(name.to_s)}</td>)
formatted_value
=
if
value
.
kind_of?
(
Array
)
"<ul>"
+
value
.
map
{
|
v
|
"<li>
#{
CGI
.
escapeHTML
(
v
.
to_s
)
}
</li>"
}.
join
+
"</ul>"
else
CGI
.
escapeHTML
(
value
.
to_s
)
end
else
CGI
.
escapeHTML
(
value
.
to_s
)
end
table
<<
%(<td class="value">#{formatted_value}</td></tr>)
end
table
<<
"</table>"
...
...
railties/lib/rails/test_unit/testing.rake
浏览文件 @
b45c9ca9
...
...
@@ -9,9 +9,9 @@ task :test do
$:
<<
"test"
pattern
=
if
ENV
.
key?
(
"TEST"
)
ENV
[
"TEST"
]
else
"test"
end
else
"test"
end
Minitest
.
rake_run
([
pattern
])
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录