大家好!很高兴宣布 Rails 3.2.13.rc1 已发布!如果没有发现任何回归问题,我将在两周后的 2013 年 3 月 13 日发布 3.2.13 最终版。如果您发现了问题,请在 GitHub 上创建一个 Issue,以便我在最终发布前修复它。
这是一个包含 287 次提交的错误修复版本。有一项大的改动,虽然技术上属于修复,但也算是一种新特性:支持 Ruby 2.0。非常感谢 Prem Sichanugrist 的辛勤工作!请在 Ruby 2.0 下测试您的应用程序,并告诉我测试情况。
Action Mailer
无变更。
Action Pack
使用简写语法时,仅根据匹配的路径确定 controller#action。以前会使用完整路径,这在嵌套(作用域和命名空间)时会导致问题。修复 #7554。回移植 #9361。
示例
# this will route to questions#new
scope ':locale' do
get 'questions/new'
end
Yves Senn
修复在 render :stream => true 时 assert_template 的问题。修复 #1743。回移植 #5288。
Sergey Nartimov
积极地填充 http 方法查找缓存,这样本地项目中的变音就不会干扰下划线方法的用法(我们不需要锁)。
Aditya Sanghi
BestStandardsSupport 不再会在每次请求时复制 X-UA-Compatible 值,以防止头信息大小爆炸。
Edward Anderson
修复了非对象 JSON 内容的 JSON 参数解析回归问题。
Dylan Smith
在使用具有非标准扩展名的文件时,使用 javascript_include_tag 可防止不必要的资产编译。
Noah Silas
修复了 sprockets 可能要求重复资产的问题。
Jeremy Jackson
将 rack 依赖项升级到 1.4.3,消除了 Rack::File 头信息弃用警告。
Sam Ruby + Carlos Antonio da Silva
使用 trailing_slash: true 时,不要在 root_url 后附加第二个斜杠
修复 #8700。回移植 #8701。
例如:# 在 root_url 之前 # => http://test.host//
# after
root_url # => http://test.host/
Yves Senn
修复 content_tag_for 在没有块时无法工作的问题。
Jasl
在路由重新加载时清除 URL 帮助方法,通过显式删除方法而不是仅仅清除模块,因为这之前工作不正常,并且可能导致内存泄漏。
Andrew White
修复 ActionDispatch::Request#raw_post 中的一个错误,该错误导致 env['rack.input'] 被读取但未重绕。
Matt Venables
在使用具有无效 :layout 参数的 render :partial 时提供更具描述性的错误消息。
修复 #8376。
render :partial => 'partial', :layout => true
# results in ActionView::MissingTemplate: Missing partial /true
Yves Senn
接受符号作为 #send_data :disposition 值。[回移植 #8329] Elia Schito
为 distance_of_time_in_words 添加 i18n 作用域。[回移植 #7997] Steve Klabnik
修复 url_for 更改 :controller 字符串选项的副作用。[回移植 #6003] 之前
controller = '/projects'
url_for :controller => controller, :action => 'status'
puts controller #=> 'projects'
之后
puts controller #=> '/projects'
Nikita Beloglazov + Andrew White
引入 ActionView::Template::Handlers::ERB.escape_whitelist。这是一个 MIME 类型列表,模板文本默认不会在此列表中被 HTML 转义。它防止 Jack & Joe 对于白名单中的 MIME 类型被渲染为 Jack & Joe。默认白名单包含 text/plain。修复 #7976 [回移植 #8235]
Joost Baaij
BestStandardsSupport 中间件现在会将 X-UA-Compatible 值附加到应用程序返回的值(如果存在)。修复 #8086 [回移植 #8093]
Nikita Afanasenko
当设置 Rails.application.default_url_options[:trailing_slash] = true 时,防止在引擎 URL 中出现双斜杠 修复 #7842
Yves Senn
当设置了 :multiple => true 和 :index 时,修复输入名称。
之前
check_box("post", "comment_ids", { :multiple => true, :index => "foo" }, 1)
#=> <input name=\"post[foo][comment_ids]\" type=\"hidden\" value=\"0\" /><input id=\"post_foo_comment_ids_1\" name=\"post[foo][comment_ids]\" type=\"checkbox\" value=\"1\" />
之后
check_box("post", "comment_ids", { :multiple => true, :index => "foo" }, 1)
#=> <input name=\"post[foo][comment_ids][]\" type=\"hidden\" value=\"0\" /><input id=\"post_foo_comment_ids_1\" name=\"post[foo][comment_ids][]\" type=\"checkbox\" value=\"1\" />
修复 #8108
Daniel Fox, Grant Hutchins & Trace Wax
Active Model
Active Record
已撤销 921a296a3390192a71abeec6d9a035cc6d1865c8,“Quote numeric values compared to string columns。” 这导致了多个回归。
Steve Klabnik
修复 ActiveRecord::Base#dup 的 default_scope 对属性的覆盖问题。
Hiroshige UMINO
修复了使用复合对象覆盖 Active Record 读取器方法,并将该属性用作 uniqueness_of 验证的作用域时出现的问题。回移植 #7072。
Peter Brown
SQLite 在复制或更改表时现在会保留自定义主键。修复 #9367。回移植 #2312。
Sean Scally + Yves Senn
使用条件预加载 has_many :through 关联时,不会缓存 :through 关联。这将防止缓存无效的子集。修复 #8423。回移植 #9252。
示例
class User
has_many :posts
has_many :recent_comments, -> { where('created_at > ?', 1.week.ago) }, :through => :posts
end
a_user = User.includes(:recent_comments).first
# this is preloaded
a_user.recent_comments
# fetching the recent_comments through the posts association won't preload it.
a_user.posts
Yves Senn
修复脏时区感知属性的处理
以前,当启用 time_zone_aware_attributes 时,在更改 datetime 或 timestamp 属性然后将其改回原始值后,changed_attributes 仍然将该属性跟踪为已更改。这导致 [attribute]_changed? 和 changed? 方法错误地返回 true。
示例
in_time_zone 'Paris' do
order = Order.new
original_time = Time.local(2012, 10, 10)
order.shipped_at = original_time
order.save
order.changed? # => false
# changing value
order.shipped_at = Time.local(2013, 1, 1)
order.changed? # => true
# reverting to original value
order.shipped_at = original_time
order.changed? # => false, used to return true
end
回移植 #9073 修复 #8898
Lilibeth De La Cruz
修复在替换 has_many :through 关联时,计数缓存列未更新的问题。回移植 #8400。修复 #7630。
Matthew Robertson
在对具有默认值的列调用破坏性方法时,不更新 column_defaults。回移植 c517602。修复 #6115。
Piotr Sarnacki + Aleksey Magusev + Alan Daud
当 #count 与 #uniq 一起使用时,我们执行 count(:distinct => true)。修复 #6865。
示例
relation.uniq.count # => SELECT COUNT(DISTINCT *)
Yves Senn + Kaspar Schiess
修复 ActiveRecord::Relation#pluck 在列或表是保留字时的问题。回移植 #7536。修复 #8968。
Ian Lesperance + Yves Senn + Kaspar Schiess
对于不支持 explain 的数据库适配器,不要对慢查询运行 explain。回移植 #6197。
Blake Smith
在脏跟踪中比较时间戳属性时,撤销对微秒的舍入。修复 #8460。
Andrew White
撤销在使用未保存模型的 has_many :through 关联上使用 collection=[] 时创建中间关联模型。修复 #7661, #8269。
Ernie Miller
修复在作用域使用 Array 时调用 new 时出现的未定义方法 to_i;修复设置整数字段为 NaN 时的 FloatDomainError。修复 #8718, #8734, #8757。
Jason Stirk + Tristan Harward
序列化属性可以序列化为整数字段。修复 #8575。
Rafael Mendonça França
使用 alter_table 处理 sqlite3 时保留索引名称。修复 #3489。回移植 #8522。
Yves Senn
识别放在包含数字和“rb”的目录中的迁移。修复 #8492。回移植 #8500。
Yves Senn
添加 ActiveRecord::Base.cache_timestamp_format 类属性来控制缓存键中时间戳值的格式。这允许用户提高缓存键的精度。修复 #8195。
Rafael Mendonça França
添加 :nsec 日期格式。这可以用于提高缓存键的精度。请注意,此格式仅适用于 Ruby 1.9,Ruby 1.8 将完全忽略它。
Jamie Gaskins
在 update_column(s) 查询中取消作用域,以忽略默认作用域。
当将 default_scope 应用于带有 where 子句的类时,使用 update_column(s) 可能会生成一个由于 default_scope 中的 where 子句被应用于更新查询而无法正确更新记录的查询。
class User < ActiveRecord::Base
default_scope where(active: true)
end
user = User.first
user.active = false
user.save!
user.update_column(:active, true) # => false
在这种情况下,我们希望跳过 default_scope 子句,仅根据主键更新记录。通过此更改
user.update_column(:active, true) # => true
回移植 #8436 修复。
Carlos Antonio da Silva
修复 PostgreSQL 适配器在有大量 schema 时 primary_key 方法的性能问题。使用 pg_constraint 表而不是 pg_depend 表,因为后者通常有很多记录。修复 #8414
kennyj
在预加载时,不要实例化中间 Active Record 对象。这些记录导致 after_find 比预期运行更多次。修复 #3313 回移植 #8403
Yves Senn
修复 pluck 与 join 一起使用的问题。回移植 #4942。
Carlos Antonio da Silva
修复非英语环境中 translate_exception 方法的问题。回移植 #6397。
kennyj
修复 TimeZoneConversion 中 nil 和空 datetime 属性的脏属性检查。将 nil datetime 设置为空字符串不应导致更改被标记。修复 #8310。回移植 #8311。
Alisdair McDiarmid
在使用 build 时,防止多重赋值给多态关联的 type 列。修复 #8265。回移植 #8291。
Yves Senn
在 Postgresql 上运行迁移时,binary 和 text 列的 :limit 选项会被静默丢弃。以前,这些迁移会导致 SQL 异常,因为 Postgresql 不支持这些类型的限制。
Victor Costan
#pluck 可用于带有 select 子句的 relation。修复 #7551。回移植 #8176。
示例
Topic.select([:approved, :id]).order(:id).pluck(:id)
Yves Senn
使用 nil? 而不是 blank? 来检查带有感叹号的动态查找器是否应引发 RecordNotFound。修复 #7238。
Nikita Afanasenko
修复在启用乐观锁定的模型上销毁对象时,从 HABTM 连接表删除的问题。修复 #5332。
Nick Rogers
在使用 ENV[“DATABASE_URL”] 时,使用查询缓存/取消缓存。修复 #6951。回移植 #8074。
kennyj
在构建 has_one 关联时,不要创建无用的数据库事务。
示例
User.has_one :profile
User.new.build_profile
回移植 #8154。
Bogdan Gusiev
AR::Base#attributes_before_type_cast 现在为序列化属性返回未序列化的值。
Nikita Afanasenko
修复在子类中覆盖 accepts_nested_attributes 时引发 NameError 的问题。
之前
class Shared::Person < ActiveRecord::Base
has_one :address
accepts_nested_attributes :address, :reject_if => :all_blank
end
class Person < Shared::Person
accepts_nested_attributes :address
end
Person
#=> NameError: method `address_attributes=' not defined in Person
之后
Person
#=> Person(id: integer, ...)
修复 #8131。
Gabriel Sobrinho, Ricardo Henrique
Active Resource
无变更。
Active Support
修复 DateTime 与 DateTime::Infinity 对象比较的问题。
Dan Kubb
移除 ActiveSupport::JSON.encode 中的代理 Unicode 字符编码。该编码方案对于基本多文种平面之外的 Unicode 字符存在问题;由于 json 默认为 UTF-8,并且我们已经强制编码为 UTF-8,因此直接传递未编码的字符。
Brett Carter
修复 mocha v0.13.0 兼容性。James Mead
#as_json 在编码哈希时隔离选项。[回移植 #8185] 修复 #8182
Yves Senn
处理 atomic.rb 由于其 chown 和 chmod 调用可能触发的权限被拒绝错误。 [回移植 #8027]
Daniele Sluijters
Railties
无变更。
完整列表
要查看完整的更改列表,请在 GitHub 上查看所有提交。
如果您想验证您的 gem 与我上传的 gem 是否相同,请使用这些 SHA-1 哈希值
6a33c2d10abb5512499addb675df658e179f2e79 actionmailer-3.2.13.rc1.gem11d8303470698c5b0ac68f187a15093c07383c89 actionpack-3.2.13.rc1.gema72dafd8b1e3372cc4dda9015b93bf5509b25baa activemodel-3.2.13.rc1.gem3c6463ab11658b5ab0fe6a4ad06eb52968ef4492 activerecord-3.2.13.rc1.gem06cec200b95dc1f64614cd03432e9ab06742a865 activeresource-3.2.13.rc1.gem5ff59cacae5295baf30a6fb8fb656037f22af3c2 activesupport-3.2.13.rc1.gemfacf4549445922d9dc2a836283ae928fa52df4f8 rails-3.2.13.rc1.gem55e44f621efbf531d9ccade6d27259f7dabae167 railties-3.2.13.rc1.gem<3<3<3