Reputation: 2209
So. For some reason I'm struggling with Rails naming today. I feel like the best naming for a model I'm creating is DNSRecord for the camel case class model name and dns_record for snake case referencing -- Rails wants to name it DnsRecord.
I've seen a solution if the entire word is capitalized for example: API
ActiveSupport::Inflector.inflections do |inflect|
inflect.acronym 'API'
end
but doesn't seem to work well as:
ActiveSupport::Inflector.inflections do |inflect|
inflect.acronym 'DNSRecord'
end
it still wants to refer to DnsRecord. I know this is a small thing but DNSRecord feels better to me.
Upvotes: 4
Views: 730
Reputation: 3507
I believe you will want inflect.acronym 'DNS'
rather than 'DNSRecord'
. You will likely also have to restart your server after updating the inflections file.
Upvotes: 6