<% module_path[..-2].each do |part| %> module <%= part %> <% end %> class <%= module_path.last %> < Foobara::DomainMapper from :integer to :string def map(from_value) from_value.to_s end end <% (module_path.size - 1).times do %> end <% end %>