mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
f4fbdb1b4e
If `AR::Enum` is used for boolean field, it would be not expected behavior for us. fixes #38075 Problem: In case of using boolean for enum, we can set with string (hash key) to instance, but we cannot set with actual value (hash value). ```ruby class Post < ActiveRecord::Base enum status: { enabled: true, disabled: false } end post.status = 'enabled' post.status # 'enabled' post.status = true post.status # 'enabled' post.status = 'disabled' post.status # 'disabled' post.status = false post.status # nil (This is not expected behavior) ``` After looking into `AR::Enum::EnumType#cast`, I found that `blank?` method converts from false value to nil (it seems it may not intentional behavior). In this patch, I improved that if it defines enum with boolean, it returns reasonable behavior. |
||
---|---|---|
.. | ||
admin | ||
all | ||
categories | ||
naked/yml | ||
reserved_words | ||
to_be_linked | ||
accounts.yml | ||
author_addresses.yml | ||
author_favorites.yml | ||
authors.yml | ||
bad_posts.yml | ||
binaries.yml | ||
books.yml | ||
bulbs.yml | ||
cars.yml | ||
categories.yml | ||
categories_ordered.yml | ||
categories_posts.yml | ||
categorizations.yml | ||
citations.yml | ||
clubs.yml | ||
collections.yml | ||
colleges.yml | ||
comments.yml | ||
companies.yml | ||
computers.yml | ||
content.yml | ||
content_positions.yml | ||
courses.yml | ||
customers.yml | ||
dashboards.yml | ||
dead_parrots.yml | ||
developers.yml | ||
developers_projects.yml | ||
dog_lovers.yml | ||
dogs.yml | ||
doubloons.yml | ||
edges.yml | ||
entrants.yml | ||
essays.yml | ||
faces.yml | ||
fk_test_has_fk.yml | ||
fk_test_has_pk.yml | ||
friendships.yml | ||
funny_jokes.yml | ||
interests.yml | ||
items.yml | ||
jobs.yml | ||
legacy_things.yml | ||
live_parrots.yml | ||
mateys.yml | ||
member_details.yml | ||
member_types.yml | ||
members.yml | ||
memberships.yml | ||
men.yml | ||
minimalistics.yml | ||
minivans.yml | ||
mixed_case_monkeys.yml | ||
mixins.yml | ||
movies.yml | ||
nodes.yml | ||
organizations.yml | ||
other_books.yml | ||
other_comments.yml | ||
other_dogs.yml | ||
other_posts.yml | ||
other_topics.yml | ||
owners.yml | ||
parrots.yml | ||
parrots_pirates.yml | ||
people.yml | ||
peoples_treasures.yml | ||
pets.yml | ||
pirates.yml | ||
posts.yml | ||
price_estimates.yml | ||
products.yml | ||
projects.yml | ||
randomly_named_a9.yml | ||
ratings.yml | ||
readers.yml | ||
references.yml | ||
ships.yml | ||
speedometers.yml | ||
sponsors.yml | ||
string_key_objects.yml | ||
subscribers.yml | ||
subscriptions.yml | ||
taggings.yml | ||
tags.yml | ||
tasks.yml | ||
topics.yml | ||
toys.yml | ||
traffic_lights.yml | ||
treasures.yml | ||
trees.yml | ||
uuid_children.yml | ||
uuid_parents.yml | ||
variants.yml | ||
vegetables.yml | ||
vertices.yml | ||
warehouse-things.yml | ||
zines.yml |