Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
values_at for active record models
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
unless instance_methods.include?(:values_at)
def values_at(*methods)
methods.flatten.map! { |method| public_send(method) }
end
end
end
@inopinatus

This comment has been minimized.

Copy link
Owner Author

@inopinatus inopinatus commented Oct 14, 2020

Until rails/rails#36481 merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment