I am working on a project which among other things involves a legacy database schema that does not follow rails conventions. In an attempt to try and hide this fact I’ve taken to aliasing all attributes to what they would have been called if built in Rails from the beginning. One place where this doesn’t work however is for foreign keys in associations. My longterm goal is being abel to change the database schema and only removing the aliases.
As an example
class Post < ActiveRecord::Base
alias_attribute :user_id :userId
For the foreign_key it’s not possible to use the aliased value
belongs_to :user, foreign_key: :userId
Is this a deliberate decision or just something that has happend naturally and never been brought up? If it’s something that you would be willing to accept a PR for I would love to give it a shot.