1. 26 7月, 2016 2 次提交
    • R
      Quoting booleans should return a frozen string · a3a6d74c
      Ryuta Kamizono 提交于
      If reuse `QUOTED_TRUE` and `QUOTED_FALSE` without frozen, causing the
      following issue.
      
      ```
      Loading development environment (Rails 5.1.0.alpha)
      irb(main):001:0> ActiveRecord::Base.connection.quote(true) << ' foo'
      => "1 foo"
      irb(main):002:0> ActiveRecord::Base.connection.quote(true) << ' foo'
      => "1 foo foo"
      irb(main):003:0> type = ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::MysqlString.new
      => #<ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::MysqlString:0x007fd40c15e018 @precision=nil, @scale=nil, @limit=nil>
      irb(main):004:0> type.serialize(true) << ' bar'
      => "1 foo foo bar"
      irb(main):005:0> type.cast(true) << ' bar'
      => "1 foo foo bar bar"
      ```
      a3a6d74c
    • R
      Merge pull request #25950 from jules2689/master · 245c64d4
      Rafael França 提交于
      Fix an exception where content-type is nil
      245c64d4
  2. 25 7月, 2016 7 次提交
    • J
      814ebb99
    • S
      aa7a6047
    • S
      Correct the behavior of virtual attributes on models loaded from the db · f0ddf87e
      Sean Griffin 提交于
      Previously we had primarily tested the behavior of these attributes by
      calling `.new`, allowing this to slip through the cracks. There were a
      few ways in which they were behaving incorrectly.
      
      The biggest issue was that attempting to read the attribute would
      through a `MissingAttribute` error. We've corrected this by returning
      the default value when the attribute isn't backed by a database column.
      This is super special cased, but I don't see a way to avoid this
      conditional. I had considered handling this higher up in
      `define_default_attribute`, but we don't have the relevant information
      there as users can provide new defaults for database columns as well.
      
      Once I corrected this, I had noticed that the attributes were always
      being marked as changed. This is because the behavior of
      `define_default_attribute` was treating them as assigned from
      `Attribute::Null`.
      
      Finally, with our new implementation, `LazyAttributeHash` could no
      longer be marshalled, as it holds onto a proc. This has been corrected
      as well. I've not handled YAML in that class, as we do additional work
      higher up to avoid YAML dumping it at all.
      
      Fixes #25787
      Close #25841
      f0ddf87e
    • X
      systematic revision of =~ usage in AV · 7ebef567
      Xavier Noria 提交于
      Where appropriate, prefer the more concise Regexp#match?,
      String#include?, String#start_with?, or String#end_with?
      7ebef567
    • X
      use \A and \z when you mean \A and \z · 11b463d8
      Xavier Noria 提交于
      In Ruby ^ and $ mean start and end of *line*.
      
      A regexp that validates an email should not check if
      some line of the string looks like an email, and maybe
      be surrounded by the entire Joyce's Ulysses. What the
      regexp has to check is if the string itself looks like
      an email.
      
      This validator is used only in tests, the ^/$ anchors
      implied no risk.
      11b463d8
    • X
      adds missing requires · 95b2a6ab
      Xavier Noria 提交于
      95b2a6ab
    • X
      systematic revision of =~ usage in AMo · 5a83f054
      Xavier Noria 提交于
      5a83f054
  3. 24 7月, 2016 5 次提交
  4. 23 7月, 2016 5 次提交
  5. 22 7月, 2016 7 次提交
  6. 21 7月, 2016 9 次提交
  7. 20 7月, 2016 5 次提交