1. 04 1月, 2014 1 次提交
    • G
      Building new records with enum scopes now works as expected · 788bb40e
      Godfrey Chan 提交于
      Previously, this would give an `ArgumentError`:
      
         class Issue < ActiveRecord::Base
           enum :status, [:open, :finished]
         end
      
         Issue.open.build # => ArgumentError: '0' is not a valid status
         Issue.open.create # => ArgumentError: '0' is not a valid status
      
      PR #13542 muted the error, but the issue remains. This commit fixes
      the issue by allowing the enum value to be written directly via the
      setter:
      
         Issue.new.status = 0 # This now sets status to :open
      
      Assigning a value directly via the setter like this is not part of the
      documented public API, so users should not rely on this behavior.
      
      Closes #13530.
      788bb40e
  2. 03 1月, 2014 5 次提交
  3. 02 1月, 2014 21 次提交
  4. 01 1月, 2014 13 次提交