Commit 1b487cdfae56cd424f4101d0ca377ee45d4021bb
1 parent
60f220f4
Exists in
master
and in
28 other branches
[stoa] Allowing attribute error name to be overwritten
Showing
1 changed file
with
14 additions
and
0 deletions
Show diff stats
app/models/person.rb
| ... | ... | @@ -4,6 +4,20 @@ class Person < Profile |
| 4 | 4 | acts_as_trackable :after_add => Proc.new {|p,t| notify_activity(t)} |
| 5 | 5 | acts_as_accessor |
| 6 | 6 | |
| 7 | + @@human_names = {} | |
| 8 | + | |
| 9 | + def self.human_names | |
| 10 | + @@human_names | |
| 11 | + end | |
| 12 | + | |
| 13 | + # FIXME ugly workaround | |
| 14 | + def self.human_attribute_name(attrib) | |
| 15 | + human_names.each do |key, human_text| | |
| 16 | + return human_text if attrib.to_sym == key.to_sym | |
| 17 | + end | |
| 18 | + super | |
| 19 | + end | |
| 20 | + | |
| 7 | 21 | named_scope :members_of, lambda { |resource| { :select => 'DISTINCT profiles.*', :joins => :role_assignments, :conditions => ['role_assignments.resource_type = ? AND role_assignments.resource_id = ?', resource.class.base_class.name, resource.id ] } } |
| 8 | 22 | |
| 9 | 23 | def memberships | ... | ... |