Sha256: 89040c57b1015433441988713a4931f1fcf06d37f5eeb85f1847e121e0e8524a

Contents?: true

Size: 726 Bytes

Versions: 1

Compression:

Stored size: 726 Bytes

Contents

class PostsController < ApplicationController
  respond_to :csv, :xls, :xlsx, :html

  def index
    respond_with(Post.all,
      :columns => export_attributes)
  end

  def stream
    respond_with(Post.all,
      :stream => true,
      :columns => export_attributes)
  end

  def stream_with_custom_url
    respond_with(Post.all,
      :stream => "/successful_redirect",
      :columns => export_attributes)
  end

  # Used for stub/mocking a redirect request
  def successful_redirect
    # make rails 3.1 happy with a template
    # /views/posts/successful_redirect.html.erb
    render :text => "OK"
  end

protected
  def export_attributes
    %w[title visits conversion_rate published_on published expired_at]
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cloudxls-rails-0.4.3 spec/test_app/app/controllers/posts_controller.rb