This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem "subdomain-fu" | |
gem "subdomain_routes" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
before_filter :prepare_for_mobile | |
# we'll render *.mobile.erb files instead of *.html.erb files when the | |
# device session variable is set to "mobile" | |
def prepare_for_mobile | |
session[:device] = params[:device] if params[:device] | |
request.format = :mobile if mobile_device? | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
before_filter :set_locale | |
protected | |
def set_locale | |
locale = params[:locale] || session[:locale] || | |
(extact_locale_from_accept_language_header=='es' ? 'es' : 'en') | |
session[:locale] = locale | |
I18n.locale = locale | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'digest/sha1' | |
class User < ActiveRecord::Base | |
attr_accessible :password | |
# password is a virtual attribute just to hold the plain password | |
# typed by the user | |
def password | |
@password |