Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 22nd, 2012  |  syntax: None  |  size: 0.49 KB  |  hits: 7  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. # Sets content type based on the information from the device info
  2.   def set_content_type
  3.     self.content_type = :mobile if request.device['is.mobile'] == 1
  4.   end
  5.  
  6.   # Fallback from the non-existing type template to html template
  7.   def _template_location(context, type, controller)
  8.     template = super
  9.     template = super(context, :mobile, controller) unless File.exists?(Merb.dir_for(:view) / "#{template}.erb")
  10.     Merb.logger.debug "Rendering template: #{template}"
  11.     template
  12.   end