Skip to content

Instantly share code, notes, and snippets.

@barroso
Created February 5, 2015 13:54
Show Gist options
  • Save barroso/ea7e6626678d1de6edc7 to your computer and use it in GitHub Desktop.
Save barroso/ea7e6626678d1de6edc7 to your computer and use it in GitHub Desktop.
create VO by db
ActiveRecord::Base.connection.tables.each do |table_name|
puts "\nclass #{table_name.camelize} < VO"
ActiveRecord::Base.connection.columns(table_name).each {|c| puts " attribute :#{c.name}, #{c.type.to_s}"}
puts "end"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment