|
|
|
|
|
by byroot
549 days ago
|
|
It could be done relatively efficiently in C indeed, but it would be yet another option, imposing et another conditional, and as I mention in the post (and will keep hammering in the followups) conditions is something you want to avoid for performance. IMO that's the sort of conversion that would be better handled by the "presentation" layer (as in ActiveModel::Serializers and al). In these gems you usually define something like: class UserSerializer < AMS::Serializer
attributes :first_name, :email
end
It wouldn't be hard for these libraries to apply a transformation on the attribute name at almost zero cost. |
|