1. 17 6月, 2020 1 次提交
    • R
      Use ES module syntax for application.js.tt and docs · 04cbaa14
      Ross Kaffenberger 提交于
      This change swaps the CommonJS require() syntax in the Webpacker
      application.js pack template file and in documentation examples with ES
      module import syntax.
      
      Benefits of this change include:
      
      Provides continuity with the larger frontend community: Arguably, one of
      the main draws in adopting Webpacker is its integration with Babel to
      support ES module syntax. For a fresh Rails install with Webpacker, the
      application.js file will be the first impression most Rails developers
      have with webpack and Webpacker.  Most of the recent documentation and
      examples they will find online for using other libraries will be based
      on ES module syntax.
      
      Reduces confusion: Developers commonly add ES imports to their
      application.js pack, typically by following online examples, which means
      mixing require() and import statements in a single file. This leads to
      confusion and unnecessary friction about differences between require()
      and import.
      
      Embraces browser-friendliness: The ES module syntax forward-looking and
      is meant to be supported in browsers. On the other hand, require()
      syntax is synchronous by design and not browser-supported as CommonJS
      originally was adopted in Node.js for server-side JavaScript. That
      webpack supports require() syntax is merely a convenience.
      
      Encourages best practices regarding optimization: webpack can statically
      analyze ES modules and "tree-shake", i.e., strip out unused exports from
      the final build (given certain conditions are met, including
      `sideEffects: false` designation in package.json).
      04cbaa14
  2. 14 6月, 2020 16 次提交
  3. 13 6月, 2020 6 次提交
  4. 12 6月, 2020 3 次提交
  5. 11 6月, 2020 6 次提交
    • R
      Merge pull request #39076 from etiennebarrie/upgrade-safe-urlsafe-csrf-tokens · 98a4c0c7
      Rafael Mendonça França 提交于
      Upgrade-safe URL-safe CSRF tokens
      98a4c0c7
    • É
      Add application config for URL-safe Base64 CSRF tokens · cf3736dc
      Étienne Barrié 提交于
      This allows applications to safely upgrade to Rails 6.1 without
      breaking tokens while the deploy is still being rolled out.
      cf3736dc
    • V
      Merge pull request #39596 from mstroming/update-4.2-release-notes-link-to-autoloading-guide · 63aa40f3
      Vipul A M 提交于
      [ci skip] 4.2 Release Notes - Update link to autoloading guide to classic mode guide inst…
      63aa40f3
    • S
      Add a setting to specify that all string columns should be immutable · 332c3364
      Sean Griffin 提交于
      In Rails 4.2 we introduced mutation detection, to remove the need to
      call `attribute_will_change!` after modifying a field. One side effect
      of that change was that we needed to enforce that the
      `_before_type_cast` form of a value is a different object than the post
      type cast value, if the value is mutable. That contract is really only
      relevant for strings, but it meant we needed to dup them.
      
      In Rails 5 we added the `ImmutableString` type, to allow people to opt
      out of this duping in places where the memory usage was causing
      problems, and they don't need to mutate that field.
      
      This takes that a step further, and adds a class-level setting to
      specify whether strings should be frozen by default or not. The default
      value of this setting is `false` (strings are mutable), and I do not
      plan on changing that.
      
      While I think that immutable strings by default would be a reasonable
      default for new applications, I do not think that we would be able to
      document the value of this setting in a place that people will be
      looking when they can't figure out why some string is frozen.
      Realistically, the number of applications where this setting is relevant
      is fairly small, so I don't think it would make sense to ever enable it
      by default.
      332c3364
    • C
      Handle quoted values in PostgreSQL range output · 45d7dad5
      Chris Andreae 提交于
      PostgreSQL uses nested quoting on output for values inside range or composite
      types under certain conditions(*), which include the format for timestamps.
      ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Range doesn't handle this in
       #cast_value.
      
      (*) If their string representation contains parentheses, commas, double quotes,
      backslashes or whitespace (manual section 8.17.5, 8.16.6).
      
      This results in a string containing nested quotes being passed to
      AR::CA::PostgreSQL::OID::DateTime, which causes two problems:
       * The special-case handling for BCE dates is bypassed, resulting in incorrect
         positive instead of negative year values.
       * ActiveModel::Type::DateTime's fast_string_to_time parser can't be used and
         falls back to Date._parse
      
      Note that this PR only implements the escaped range bound format when parsing
      Postgres output, not when serializing values for Postgres. Postgres also
      requires its input to be escaped in the same cases, with the exception of
      whitespace. Fortunately, none of Postgres' pre-defined range types use any
      characters requiring escaping other than whitespace. See Rails PR #39585 for the
      serialization side.
      45d7dad5
    • R
      Merge pull request #39588 from kamipo/use_statement_cache_for_sti_class · 7118c435
      Ryuta Kamizono 提交于
      Use statement cache for STI classes
      7118c435
  6. 10 6月, 2020 8 次提交