routing - Change request format based on subdomain in Rails 3 -
routing - Change request format based on subdomain in Rails 3 -
on rails 3 site, if user comes in through subdomain (say, mob.example.com
), want alter request format of request ":mobile".
what's sensible way this, , should set code?
i wound doing in way thought reasonable:
module mobilizedcontroller extend activesupport::concern included before_filter :set_mobile_request_format, :if => :mobile_subdomain? end private def set_mobile_request_format request.format = :mobile end def mobile_subdomain? request.subdomains.include? 'm' end end class applicationcontroller include mobilizedcontroller end
ruby-on-rails-3 routing
Comments
Post a Comment