Hey everyone,

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 `user_id`
  belongs_to :user, foreign_key: :userId
end

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.


Regards
Hugo

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to