Sha256: 1694081dee4c7858b69c64ee3841e5e46b5aedfd1be00b9d15acbe76966e6ed2

Contents?: true

Size: 601 Bytes

Versions: 1

Compression:

Stored size: 601 Bytes

Contents

class UsersController < ApplicationController
  def index
    @users = User.includes(:groups)
    respond_to do |format|
      format.html
      format.csv { render csv: @users, fields: [:id, :name, :age, :"groups.first.name"], without_header: true }
      format.tsv { render tsv: @users, fields: [:id, :name, :age, :"groups.first.name"], without_header: true }
    end
  end

  def sjis
    @users = User.includes(:groups).to_a
    respond_to do |format|
      format.html
      format.csv { render csv: @users, fields: [:id, :name, :age, :"groups.first.name"], encoding: 'SJIS' }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
csv_rails-0.7.0 test/dummy/app/controllers/users_controller.rb