Skip to content

Commit

Permalink
set default values for database fields, country salutation and corre…
Browse files Browse the repository at this point in the history
…spondence_language
  • Loading branch information
Icewater1337 committed Mar 30, 2015
1 parent 82c5cb6 commit cc243b0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/models/pbs/person.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ module Pbs::Person
timeliness: { type: :date, allow_blank: true }

alias_method_chain :full_name, :title

after_initialize :defaults, unless: :persisted?
# ":if => :new_record?" is equivalent in this context

end

def defaults
self.country = "Schweiz"
self.salutation = "lieber_pfadiname"
self.correspondence_language = "de"
end

def salutation_label
Expand Down

0 comments on commit cc243b0

Please sign in to comment.