Sha256: f6f36746df022ce180ef865f85b8b74d9873cb30761795be81b01f5f74b230d7

Contents?: true

Size: 488 Bytes

Versions: 4

Compression:

Stored size: 488 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 }
    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

4 entries across 4 versions & 1 rubygems

Version Path
csv_rails-0.6.0 test/dummy/app/controllers/users_controller.rb
csv_rails-0.5.2 test/dummy/app/controllers/users_controller.rb
csv_rails-0.5.1 test/dummy/app/controllers/users_controller.rb
csv_rails-0.5.0 test/dummy/app/controllers/users_controller.rb