Ruby on Rails
Thursday, April 25, 2013
I finally figured this out. I have an action that only renders html, but googlebot for instance wants text. So, I added this to the controller and everything works!
before_filter :force_html_requests, :only => :show
def force_html_requests
request.format = :html
end
Rick
On Monday, November 26, 2012 6:01:19 PM UTC-6, jim wrote:
--On Tue, Nov 27, 2012 at 7:54 AM, Rick Cockerham <li...@ruby-forum.com> wrote:
Excellent suggestion. From the page view I see this agent:
Mozilla/5.0 (compatible; oBot/2.3.1; +http://filterdb.iss.net/crawler/ )
So, how do I setup my app to only accept html requests for those routes?
Or, just not fail when it wants text?try passing a formats option to render.render partial: 'foo', formats: [:html]
Thanks
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com .
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com .
For more options, visit https://groups.google.com/groups/opt_out .
--
------------------------------------------------------------ -
visit my blog at http://jimlabs.heroku.com
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/GjeWL-1w3bMJ.
For more options, visit https://groups.google.com/groups/opt_out.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment