Skip to content

Instantly share code, notes, and snippets.

@jonathanpa
Created September 28, 2017 19:26
Show Gist options
  • Save jonathanpa/f3daeee05b0154aa1cda507841f869cb to your computer and use it in GitHub Desktop.
Save jonathanpa/f3daeee05b0154aa1cda507841f869cb to your computer and use it in GitHub Desktop.
entity_class = "#{ARGV[0]}Entity".constantize
model_class = "#{ARGV[0]}".constantize
output_path =
Rails.root.join('spec', 'fixtures', 'entities', "#{ARGV[0].underscore}.yml")
File.open(output_path, 'w') do |file|
file.write(
entity_class
.represent(model_class.new)
.serializable_hash
.keys
.map(&:to_s)
.to_yaml
)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment