Commit message (Collapse) | Author | Age | Files | Lines | ||
---|---|---|---|---|---|---|
... | ||||||
* | Whitespace [ci skip] | Rafael Mendonça França | 2014-01-03 | 1 | -1/+1 | |
| | ||||||
* | Building new records with enum scopes now works as expected | Godfrey Chan | 2014-01-03 | 1 | -2/+8 | |
| | | | | | | | | | | | | | | | | | | | | | | 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. | |||||
* | Improve enum documentation | Robin Dupret | 2014-01-01 | 1 | -1/+6 | |
| | | | | | Add a mention about the automatic generation of scopes based on the allowed values of the field on the enum documentation. | |||||
* | Fix the enums writer methods | Robin Dupret | 2014-01-01 | 1 | -1/+1 | |
| | | | | | | | | | | | Previously, the writer methods would simply check whether the passed argument was the symbol representing the integer value of an enum field. Therefore, it was not possible to specify the numeric value itself but the dynamically defined scopes generate where clauses relying on this kind of values so a chained call to a method like `find_or_initialize_by` would trigger an `ArgumentError`. Reference #13530 | |||||
* | Add the ability to nullify the `enum` column | Amr Tamimi | 2014-01-01 | 1 | -1/+6 | |
| | ||||||
* | Fix comment example in AR enum [ci skip] | Carlos Antonio da Silva | 2013-12-23 | 1 | -1/+1 | |
| | ||||||
* | Use the same enum definition in the docs and in the comments [ci skip] | Godfrey Chan | 2013-12-22 | 1 | -6/+6 | |
| | ||||||
* | Very tiny typo fix [ci skip] | Robin Dupret | 2013-12-06 | 1 | -1/+1 | |
| | ||||||
* | _enum_methods_module should be kept private | Godfrey Chan | 2013-12-05 | 1 | -6/+7 | |
| | ||||||
* | Make clear that the enum array should not be changed once defined. [ci skip] | Godfrey Chan | 2013-12-05 | 1 | -1/+12 | |
| | ||||||
* | bring back constant to expose the enum mapping as HWIA. | Yves Senn | 2013-11-06 | 1 | -4/+13 | |
| | ||||||
* | update the AR enum docs to match the actual behavior. [ci skip] | Yves Senn | 2013-11-06 | 1 | -5/+3 | |
| | ||||||
* | store enum mapping using `Strings` instead of `Symbols`. | Yves Senn | 2013-11-05 | 1 | -1/+2 | |
| | | | | | This allows to assign both `String` and `Symbol` values to the enum without having to call `to_sym`, which is a security problem. | |||||
* | direct enum assignment rasies ArgumentError for unknown values. | Yves Senn | 2013-11-05 | 1 | -1/+6 | |
| | ||||||
* | define enum methods inside a `Module` to make them overwritable. | Yves Senn | 2013-11-05 | 1 | -13/+24 | |
| | ||||||
* | The enum value constant isn't used, so rm it for now. | Aaron Patterson | 2013-11-04 | 1 | -17/+7 | |
| | ||||||
* | stop doing the same calculation over and over | Aaron Patterson | 2013-11-04 | 1 | -4/+5 | |
| | ||||||
* | Fix failures related to enum changes | Carlos Antonio da Silva | 2013-11-04 | 1 | -6/+4 | |
| | | | | | | Commit 6e4a810f51b9ed2468b92247ef5568cc9d6dbcc0 changed the implementation from class_eval to define_method, but missed the access to the constant versus the access to the constant name. | |||||
* | Replace `class_eval` with `define_method` for enum | Vitaly Tatarintsev | 2013-11-04 | 1 | -4/+12 | |
| | | | | https://github.com/rails/rails/commit/db41eb8a6ea88b854bf5cd11070ea4245e1639c5#commitcomment-4502683 | |||||
* | Move documentation around a bit | David Heinemeier Hansson | 2013-11-02 | 1 | -4/+7 | |
| | ||||||
* | Explicit mapping for enum | Yury Korolev | 2013-11-02 | 1 | -1/+5 | |
| | ||||||
* | Fix to work on Ruby 1.9.3, example and changelog improvements | Carlos Antonio da Silva | 2013-11-02 | 1 | -5/+5 | |
| | ||||||
* | Added ActiveRecord::Base#enum for declaring enum attributes where the values ↵ | David Heinemeier Hansson | 2013-11-02 | 1 | -0/+60 | |
map to integers in the database, but can be queried by name |