Sha256: 3ec24081d2da0db063b430ebffb56e88d0d7fe42db7b66a8e366a05d2145b0ca

Contents?: true

Size: 600 Bytes

Versions: 1

Compression:

Stored size: 600 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).all
    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.6.1 test/dummy/app/controllers/users_controller.rb