Skip to content

Instantly share code, notes, and snippets.

View AlphaLiu's full-sized avatar
🌴
On vacation

Alpha is not home AlphaLiu

🌴
On vacation
View GitHub Profile
# -*- encoding : utf-8 -*-
class Subdomain
def self.matches?(request)
case request.host
when Setting.host, "www.#{Setting.host}", nil
false
else
true
end
@nightire
nightire / Rails 4 - Active Record Associations.md
Last active March 27, 2016 12:40
Rails 4 - Active Record Associations

Rails 4 - Active Record Associations

has_one

一对一关系:有 A 和 B,A 拥有且仅拥有一个 B

has_one

belongs_to