This way screen reader users will know which record they're going to access when focusing on a link to a certain action. Otherwise they'd hear something like "Edit, link", and they wouldn't know which record they'll end up editing if they follow the link.
10 lines
204 B
Ruby
10 lines
204 B
Ruby
module HumanName
|
|
def human_name
|
|
%i[title name subject].each do |method|
|
|
return send(method) if respond_to?(method)
|
|
end
|
|
|
|
raise "Must implement a method defining a human name"
|
|
end
|
|
end
|