Skip to content

Instantly share code, notes, and snippets.

View evg2108's full-sized avatar

Eugene Gavrilov evg2108

  • Russian Federation, Krasnoyarsk
View GitHub Profile
@rossmari
rossmari / tips.md
Last active August 29, 2015 14:04
Device mountable, using devise in engine (isolated and non-isolated)
@stereoscott
stereoscott / application_controller.rb
Last active January 31, 2021 14:08
Returning mobile views from rails, either by using a custom view path ("views_mobile") or by setting a custom request format.
class ApplicationController < ActionController::Base
before_filter :prepend_view_path_if_mobile
def mobile_request?
@mobile_request ||= (request.subdomains.first == domain_prefixes[:mobile])
end
helper_method :mobile_request?
def prepend_view_path_if_mobile
prepend_view_path Rails.root + 'app' + 'views_mobile' if mobile_request?