# how to define the csv export inside of the model class User < ActiveRecord::Base include Reportable # override some of the reportable methods class << self def report_scope # defaults to 'all' but you could do a custom scope like this... joins(:addresses) end def csv_builder csv = CSVBuilder.new({ resource: self }) do column :id column :user_id column :first_name column :last_name column("Address") { |user| user.primary_address.try(:to_str) } column :created_at end end end end