class Report < ActiveRecord::Base validates :name, :internal_identifier, :uniqueness => true before_create :set_default_template def set_default_template self.template = "

<%= title %>

<% columns.each do |column| %> <% end %> <% rows.each do |row| %> <% row.values.each do |value| %> <% end %> <% end %>
<%= column %>
<%= value %>
<%= report_download_link(unique_name, :csv, 'Download CSV') %> | <%= report_download_link(unique_name, :pdf, 'Download PDF') %>" end end