[
"id",
"other_id",
"other_type",
"stuff",
"things",
"comments_count",
"created_at",
"updated_at"
]
[
#<ActiveRecord::...::Column @name="id">,
#<ActiveRecord::...::Column @name="other_id">,
#<ActiveRecord::...::Column @name="other_type">,
#<ActiveRecord::...::Column @name="stuff">,
#<ActiveRecord::...::Column @name="things">,
#<ActiveRecord::...::Column @name="comments_count">,
#<ActiveRecord::...::Column @name="created_at">,
#<ActiveRecord::...::Column @name="updated_at">
]
[
#<ActiveRecord::...::Column @name="stuff">,
#<ActiveRecord::...::Column @name="things">,
#<ActiveRecord::...::Column @name="comments_count">,
#<ActiveRecord::...::Column @name="created_at">,
#<ActiveRecord::...::Column @name="updated_at">
]
{
"id" => 1,
"other_id" => 2,
"other_type" => Other,
"stuff" => "A"
"things" => "B"
"comments_count" => 3
"created_at" => 2015-09-23 09:52:40 -0700
"updated_at" => 2015-09-23 09:52:40 -0700
}
Use case: cleaning up places where I need to name the set of values slice("all", "the", "things")
everywhere. When adding columns (middle_name etc.) this gets messy.
[
"stuff",
"things"
]
This could be defined as a static whitelist on each model, or by blacklisting keys, timestamps, counter caches, etc. Essentially the result should be the assignable value columns that hold data input, not managed by ActiveRecord.
{
"stuff" => "A"
"things" => "B"
}
data_changes
data_changed
data_changed?
- etc.?
I can't decide on core_
or data_
as the prefix. Got any better ones?