Skip to content

Instantly share code, notes, and snippets.

@eccyan
Created January 25, 2012 05:18
Show Gist options
  • Save eccyan/1674880 to your computer and use it in GitHub Desktop.
Save eccyan/1674880 to your computer and use it in GitHub Desktop.
Railsでデプロイ環境に合わせてrobots.txtを出力するコントローラ ref: http://qiita.com/items/1876
class RobotsController < ApplicationController
def index
render_text = File.read "#{::Rails.root}/public/robots.#{::Rails.env}.txt"
respond_to do |format|
format.text { render :text => render_text, :layout => false }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment