Skip to content

Commit

Permalink
Added docs about how to specify gender method when using petrovish as…
Browse files Browse the repository at this point in the history
… a mixin
  • Loading branch information
tanraya committed Apr 27, 2013
1 parent 0aeb2ff commit 5c31474
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class User < ActiveRecord::Base

petrovich :firstname => :my_firstname,
:middlename => :my_middlename,
:lastname => :my_lastname
:lastname => :my_lastname,
:gender => :my_gender

def my_firstname
'Пётр'
Expand All @@ -59,6 +60,13 @@ class User < ActiveRecord::Base
def my_lastname
'Петренко'
end

# Если пол не был указан, используется автоматическое определение
# пола на основе отчества. Если отчество так же не было указано,
# пытаемся определить правильное слконение на основе файла правил.
def my_gender
:male # :male, :female или :both
end
end
```

Expand All @@ -68,6 +76,7 @@ end
class Person
include Petrovich::Extension

# А здесь мы не указали пол - он будет определяться на основе отчества
petrovich :firstname => :name,
:middlename => :patronymic,
:lastname => :surname
Expand Down

0 comments on commit 5c31474

Please sign in to comment.